Need to specify proxy settings

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.

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

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 https://index.docker.io/v1/search?q=cassandra&n=25: 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
Client:
 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

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

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?

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

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

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?

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.io/library/nginx
docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/nginx/images: x509: certificate signed by unknown authority.
See 'docker run --help'.

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

+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=http://10.0.2.2:1234 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.

1 Like

+1 Solution? Anyone?

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.

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.

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 http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty Release.gpg
Ign http://archive.ubuntu.com trusty Release
Err http://archive.ubuntu.com trusty/main Sources

Err http://archive.ubuntu.com trusty/main Sources
  403  Use Proxy Server
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/source/Sources  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?

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

For build, it is different from run. Use https://docs.docker.com/engine/reference/commandline/build/#/set-build-time-variables-build-arg. Basically keep your proxy setting out of the Dockerfile but configure your daemon appropriately as normal.

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.

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?

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

Thanks for responses! Worked perfectly! :heart_eyes: