In some of the corporate networks, you will need to set the proxy settings for Docker to be able to communicate with external world. Usually the proxy is of the format
'http://<username>:<password>@<hostname>:<port>'
For some linux versions on which Docker is installed, the setting can be made in
mkdir -p /etc/systemd/system/docker.service.d
Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
$ sudo systemctl daemon-reload
$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/
$ sudo systemctl restart docker
NOTE: For some version of Linux (say Oracle), you will need to set the proxy settings in
$ cat /etc/sysconfig/docker
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker daemon
other_args=""
export HTTP_PROXY="http://myproxy:80"
export HTTPS_PROXY="http://myproxy:80"
HTTP_PROXY="http://myproxy:80"
HTTPS_PROXY="http://myproxy:80"
Restart the docker service,
# /etc/init.d/docker restart
Stopping docker: [ OK ]
Starting docker: . [ OK ]
'http://<username>:<password>@<hostname>:<port>'
For some linux versions on which Docker is installed, the setting can be made in
mkdir -p /etc/systemd/system/docker.service.d
Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
$ sudo systemctl daemon-reload
$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/
$ sudo systemctl restart docker
NOTE: For some version of Linux (say Oracle), you will need to set the proxy settings in
$ cat /etc/sysconfig/docker
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker daemon
other_args=""
export HTTP_PROXY="http://myproxy:80"
export HTTPS_PROXY="http://myproxy:80"
HTTP_PROXY="http://myproxy:80"
HTTPS_PROXY="http://myproxy:80"
Restart the docker service,
# /etc/init.d/docker restart
Stopping docker: [ OK ]
Starting docker: . [ OK ]