Docker Community Forums

Share and learn in the Docker community.

Need to specify proxy settings

(Chris) #62

I suspect we need the OSX (launchd?) equivalent of these instructions for ubuntu:

I was getting the same error on my new ubuntu machine until I followed these instructions.

I tried using launchctl setenv http_proxy http://... and restarting the docker service but no luck.

Unfortunately I don’t know the OSX environment well enough to do this work but I will be looking into that.

(Nate Mara) #63

I am also not seeing the system proxy settings take hold. I’m using Version 1.12.0-rc2-beta17

(Alexandre Duros) #64

As far as I understand, docker does not completely ignore proxy settings.
When I typed docker info, I see :

Http Proxy: http://<proxy_server>:<port>
Https Proxy: http://<proxy_server>:<port> 

Where proxy_server and port are my OSX settings, not my environment variables.
But it ignore authentication parameters, since when I search a docker image, I get

$ docker search cassandra
Error response from daemon: Get Proxy Authentication Required 

Actually, I was looking at the code (I’m discovering it, so I may be wrong), but I see that It just take environment variables :

But actually, it does not take environments variables but OSX settings. However, I don’t figure out how docker get OSX settings proxy, but it seems that it just skips authentication informations.

$ docker version
 Version:      1.12.0-rc3
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   91e29e8
 Built:        Sat Jul  2 00:09:24 2016
 OS/Arch:      darwin/amd64
 Experimental: true

 Version:      1.12.0-rc3
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   876f3a7
 Built:        Tue Jul  5 02:20:13 2016
 OS/Arch:      linux/amd64
 Experimental: true

(Nate Mara) #65

That makes sense, so is there a way that docker build can take proxy auth information, or just prompt for info on an HTTP 407?

(Thecb4) #66

The system proxy settings are not sufficient for docker to use and I need to run a special proxy analysis every time my network switches. This solution is somewhat DOA for me. If I could force the script to run before each restart of docker and docker use those proxy settings, that would be ideal.

Server Version: 1.12.0-rc3

(Elijah Chancey) #67

I wanted to bump this thread. I would REALLY would love to have proxy support to speed up the building of containers. Thanks!

(Jhampson) #68

yes ditto Bump - Sounds like I am having the same problem. I also posted here:

has anyone tested if this error occurs if you dont have a proxy to go through?

(Sandeeptv) #69

I tried to configure the proxy in the docker preferences from the docker app on mac. but i get an error

docker run -d -p 80:80 --name webserver nginx
Unable to find image 'nginx:latest' locally
Pulling repository
docker: Error while pulling image: Get x509: certificate signed by unknown authority.
See 'docker run --help'.

(Vijay Balakrishnan) #70

+1 for proxy support. I am also unable to use it behind the proxy wall on the Mac with the latest stable build.

(Protenhan) #71

+1 for this, too.
I’m also having trouble getting my proxy setup to work.
I need to connect to a local http proxy running on my machine which then routes the traffic to our corporate NTLM proxy. But obviously setting something like http_proxy=http:localhost:1234 will not work. In Virtualbox there is a “magic” IP address where you can always connect to the host OS. So I can set http_proxy= and it works like a charm. I really would love to have something like this as an option in order to be able to have containers using my local proxy.

(Jhampson) #72

+1 Solution? Anyone?

(Bcg62) #73

How is this still an issue?

Its a complete showstopper for any one behind a proxy server which is probably a majority of corporate users. Not to mention theres also no easy way to insert CA’s for ssl inspection.

It really takes 4+ months to get this functionality in? I find that very hard to believe, Please fix this so i can stop telling people someday docker might work locally on osx within our corporate network.

(Protenhan) #74

The only way I found around this whole problem was to package my local http proxy into a docker container and route all traffic from other containers to this one. It is a tedious solution but at least It works for me now.

(Allen McPherson) #75

I’m having the same problem, but I really want to understand if it’s really a problem.

I’m running Docker for Mac 1.12.0-1 under 10.10.3

If I look at the Docker Preferences screen, in the Advanced tab, I see that my proxies have been extracted from the OS (though they are greyed out). Also, when I do a docker info I see the correct proxy information.

However, when I try to build the simple Dockerfile below:

FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay

I get:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM docker/whalesay:latest
 ---> 6b362a9f73eb
Step 2 : RUN apt-get -y update && apt-get install -y fortunes
 ---> Running in f433f36bae72
Ign trusty InRelease
Ign trusty Release.gpg
Ign trusty Release
Err trusty/main Sources

Err trusty/main Sources
  403  Use Proxy Server
W: Failed to fetch  403  Use Proxy Server

E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get -y update && apt-get install -y fortunes' returned a non-zero code: 100

However, if I add proxy info to the apt-get line (which I found somewhere whilst Googling), everything works OK.

RUN http_proxy='http://<proxy host>:8080' https_proxy='http://<proxy host>:8080' apt-get -y update && http_proxy='http://<proxy host>:8080' https_proxy='http://<proxy host>:8080' apt-get install -y fortunes

My questions:

  1. Is this expected behavior?
  2. It seems that the docker daemon should use the machines OS settings for proxies so that they do not need to be embedded in the Dockerfile. Yes? No?

(Nussiri) #76

I solved the problem with my proxy in the same way, yet it helped. Let’s see what will happen next.

(Chris Fordham) #77

For build, it is different from run. Use Basically keep your proxy setting out of the Dockerfile but configure your daemon appropriately as normal.

(Tggirish) #78

In my case my network password had changed. I went to the docker settings and put my new password in and voila everything started to work again.

(Rjaeckel) #79

To me this issue doesn’t seem to be fixed. I am behind a corporate proxy and I am not able to get it working. Anyone has an easy workaround?

(Brian Albright) #80

This issue does not seem fixed to me either. The issue being on OSX I cannot set the build environment variables from outside the build command / process.

My use case is where automation, in-office, and out-of-office employees all need to use the same codebase, and be able to execute and build the system under test. Proxy settings are different between each use case, and it’s unreasonable to expect someone to make upstream code changes to accommodate local network setups.

I’m still hunting for any solution that allows me to service this other than “cache the intermediate build layers at Starbucks before coming into the office”.

(Insta724) #81

Thanks for responses! Worked perfectly! :heart_eyes: