0

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:

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

Chris Watts
  • 822
  • 1
  • 9
  • 27
  • @jww, i wasnt sure which of the sites to post to so went with "my usual digs", I shall move the question over there. Thanks – Chris Watts Feb 26 '19 at 08:10

2 Answers2

1

This turned out to be a double instance installation. Confusingly ubuntu server comes with docker installed under package manager - snap, so installing under apt-get led to double installation.

I think this is a poor way to manage Ubuntu server, I would expect a plain, vanilla OS with nothing installed.. Hopefully this helps someone else in the future!

Chris Watts
  • 822
  • 1
  • 9
  • 27
0

have you tried to configure the proxy in ~/.docker/config.json with :

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://127.0.0.1:3001",
     "httpsProxy": "http://127.0.0.1:3001",
     "noProxy": "*.test.example.com,.example2.com"
   }
 }
}

as mentionned at https://docs.docker.com/network/proxy/#configure-the-docker-client ?

Kerat
  • 1,284
  • 10
  • 15