Docker behind a proxy requires restart on boot

I apologise if I have put this into the wrong discussion topic/area in the forum, I am not entirely sure where it belongs.

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: and

I have the docker service set to auto-start on machine boot, however, 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 now (logging in after reboot and restarting docker), but I need to be able to use this machine remotely using auto-builds/deployments etc. and not worry about restarts (e.g.: if power is lost and machine auto restarts on power restoration). Without restarting the service, the builds break as docker service tries to connect directly, not through the proxy.

I have emailed Docker support, and have waited around 4 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:

  1. I have created the http-proxy.conf in /etc/systemd/system/docker.service.d and created the Environment variable there for the proxy.

  2. 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!

  3. I have also set/configured the client config in ~/.docker/config.json to have the proxies in.

The proxy is definitely up, running and operational. It’s the corporate proxy, I can WGET/CURL successfully prior to restarting the docker service so its not that the proxy isnt working.