I apologise if I am posting this in the wrong section, I need some help and unsure where to turn to.
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.
Unfortunately I cannot get any help from Docker support, I have waited around 3 weeks for them to reply with no luck. This problem is more than likely me not understanding linux services/daemons. Can someone help me out?
To confirm 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!EDIT: I have also set/configured the client config in
~/.docker/config.json
to have the proxies in. (as mentioned in the answers below by Kerat)
Any assistance is much appreciated, I am totally stuck with why it wont read the options in on startup.