+1 I think from me.
I think this thread illustrates my exact problem but I will highlight a different use case.
I work in a corporate environment that requires outbound internet access to go through an authenticating proxy. To avoid my credentials from being exposed everywhere in config files and whatnot, I’ve setup a local proxy running on my laptop that forwards to my corporate proxy. So, I’ve got my Max os proxy settings pointing to http://127.0.0.1:8118.
Using Docker for Mac, there are two kinds of problems that arise from this.
First, if I want to search/pull/run a container from Dockerhub, for example using something simple like “docker search hello”. I get this error in a Terminal window:
Error response from daemon: Get https://index.docker.io/v1/search?q=hello&n=25: http: error connecting to proxy http://127.0.0.1:8118: dial tcp 127.0.0.1:8118: getsockopt: connection refused
I can get around this by finding the actual IP address of my host and setting my proxy environment variables to this IP address (btw - this only works if I change the system settings - I can’t just export these in the terminal window and have Docker for Mac pick them up). But like the original poster said, this IP address changes. The way it works using Docker Toolbox/Machine/Engine is that I’m able to use Virtualbox’s 10.0.2.2 address to access the host so I have the proxy settings inside the DockerMachine VM configured to point to http://10.0.2.2:8118.
Now, even if I solve that problem, I have a second problem. Let’s say I’ve got a container that now needs outbound Internet access. I haven’t tried this use case but I’m almost certain it will fail for the same reasons, I can’t point my http_proxy env variable inside the container to a reachable address. In the Docker Toolbox/Machine/Engine world, I can do this “easily” with “export http_proxy=http://10.0.2.2:8118”. I suspect if I use the host’s actual IP address this will work, but again its always changing so it is really not useful.
By the way, I’ve also tried eliminating my local proxy and going direct to the corporate proxy but that doesn’t work either:
Error response from daemon: Get https://index.docker.io/v1/search?q=hello&n=25: Proxy Authentication Required
So, I’ve probably got 3 actual issues here that could be documented separately but I just don’t know if address the original poster’s problem will address all 3 or not…