I am trying to run docker behind a proxy on a linux/ubuntu server machine. I have configured every proxy on the box (FTP/HTTPS/HTTP), I have also configured the Docker proxies mentioned here: https://docs.docker.com/config/daemon/systemd/#httphttps-proxy and https://stackoverflow.com/a/28093517/4261713
However, I have the docker service set to auto-start on machine boot, unless I log onto the machine and run
sudo service docker restart those settings are ignored, and docker fails to use a proxy. This is all fine, we have a work around for local access, but I need to use this machine remotely using auto-builds/deployments etc. Therefore, the builds break without running that command.
What I have already tried:
I have created the http-proxy.conf in /etc/systemd/system/docker.service.d and created the Environment variable there for the proxy.
I have tried to modify the docker service init.d file by adding to the
"DOCKER_OPTS"variable at the top using
-e "HTTP_PROXY=http://addressofproxy:portofproxy" -e "HTTPS_PROXY=http://addressofproxy:portofproxy"However, this also has made no difference and I still need to restart the service after a reboot!
I have also set/configured the client config in
~/.docker/config.jsonto have the proxies in.
Docker was installed using
sudo apt-get install docker.io from command line, it was not built from source.
Host and Versions info:
Ubuntu Version (
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic
Docker version 18.06.1-ce, build e68fc7a
Installed Package (
sudo apt list --installed | grep docker):
docker.io/bionic-updates,bionic-security,now 18.06.1-0ubuntu1.2~18.04.1 amd64