Home Explore Blog CI



docker

2nd chunk of `content/manuals/engine/cli/proxy.md`
bd31e7b554fb387c3fc799646b71c5a9d659ff06c4512a1c000000010000090d
| :----------- | :---------------------------------------------------------------------------------- |
| `httpProxy`  | Sets the `HTTP_PROXY` and `http_proxy` environment variables and build arguments.   |
| `httpsProxy` | Sets the `HTTPS_PROXY` and `https_proxy` environment variables and build arguments. |
| `ftpProxy`   | Sets the `FTP_PROXY` and `ftp_proxy` environment variables and build arguments.     |
| `noProxy`    | Sets the `NO_PROXY` and `no_proxy` environment variables and build arguments.       |
| `allProxy`   | Sets the `ALL_PROXY` and `all_proxy` environment variables and build arguments.     |

These settings are used to configure proxy environment variables for containers
only, and not used as proxy settings for the Docker CLI or the Docker Engine
itself.
Refer to the [environment variables](/reference/cli/docker/#environment-variables)
and [configure the Docker daemon to use a proxy server](/manuals/engine/daemon/proxy.md)
sections for configuring proxy settings for the CLI and daemon.

### Run containers with a proxy configuration

When you start a container, its proxy-related environment variables are set
to reflect your proxy configuration in `~/.docker/config.json`.

For example, assuming a proxy configuration like the example
shown in the [earlier section](#configure-the-docker-client), environment
variables for containers that you run are set as follows:

```console
$ docker run --rm alpine sh -c 'env | grep -i  _PROXY'
https_proxy=http://proxy.example.com:3129
HTTPS_PROXY=http://proxy.example.com:3129
http_proxy=http://proxy.example.com:3128
HTTP_PROXY=http://proxy.example.com:3128
no_proxy=*.test.example.com,.example.org,127.0.0.0/8
NO_PROXY=*.test.example.com,.example.org,127.0.0.0/8
```

### Build with a proxy configuration

When you invoke a build, proxy-related build arguments are pre-populated
automatically, based on the proxy settings in your Docker client configuration
file.

Assuming a proxy configuration like the example shown in the
[earlier section](#configure-the-docker-client), environment
are set as follows during builds:

```console
$ docker build \
  --no-cache \
  --progress=plain \
  - <<EOF
FROM alpine
RUN env | grep -i _PROXY
EOF
```

```console
#5 [2/2] RUN env | grep -i _PROXY
#5 0.100 HTTPS_PROXY=https://proxy.example.com:3129

Title: Running Containers and Building Images with Proxy Configuration
Summary
This section explains how to run containers and build images using the proxy configurations defined in the Docker client's configuration file (~/.docker/config.json). It shows how proxy-related environment variables are automatically set for containers and how proxy-related build arguments are pre-populated during image builds.