Docker behind a proxy

Docker behind a proxy

Docker does not use environment variables for proxy configuration. This article presents how to configure Docker to use a proxy.

To use docker behind a proxy, create the file /etc/systemd/system/docker.service.d/http-proxy.conf With the following content:

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8118/"
Environment="HTTPS_PROXY=http://127.0.0.1:8118/"
Environment="NO_PROXY=localhost,127.0.0.1,172.16.98.151"

Here, 127.0.0.1:8118 should be replaced by the address of your proxy

Once done, reload the daemon and restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker