Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
HTTP Proxy settings from preferences are injected as environment variables in containers #981
I am behind a corporate proxy so I configured the preferences with an HTTP Proxy so that I can pull images from Docker Hub when building my containers, but don't expect the same settings to be injected into the containers as environment variables.
The images are pulled successfully through the proxy however, the same HTTP Proxy settings are being injected in to the containers as environment variables. This causes some issues since I am using docker-compose to link two containers and they are attempting to communicate with each other through the proxy (which fails). I tried to exclude the hostnames of the linked containers via the preferences, hoping that they will be injected as $NO_PROXY but this doesn't happen.
Steps to reproduce the behavior
@ebriney That might be a workaround but it doesn't solve the issue.
I'm hoping that setting the HTTP Proxy settings in the app preferences will have the same effect as setting the environment variables for the docker daemon in systemd. See: https://docs.docker.com/engine/admin/systemd/#/http-proxy
When doing the above the HTTP Proxy environment variables do not get injected into containers. It should be the same on macOS. These settings are only for enabling a connection to Docker registries through a proxy.
Strongly agree, this behavior where a proxy I happen to be using for web browsing on my mac automatically and without my choice gets injected into all containers seems a bit nuts.
This feature, although documented (https://docs.docker.com/docker-for-mac/networking/), is too clever, causes more confusion than it's worth. Let users enter the proxy in the Docker Preferences tab, anyway there's no guarantee you'd want to use the same proxy the Mac is otherwise using.
And a really bad bug is that Docker for Mac doesn't "reset" this after "unchecking" "Web Proxy (HTTP)" in Settings => Network => Proxies tab. The old value is still in the Docker Preferences, grayed out. I have to actually delete the ip and port from the Mac settings, even though those fields are being ignored by the Mac.
@lukevella the latest master builds of Docker for Mac have experimental support for transparent HTTP(S) proxying. If this special mode is enabled then no environment variables are rewritten. If you'd like to try it, I've written some instructions: https://github.com/moby/vpnkit/blob/master/docs/transparent-http-proxy.md
(Note the current implementation doesn't currently support
Feedback is very welcome!
Issues go stale after 90d of inactivity.
Prevent issues from auto-closing with an
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
@djs55 I think this issue may be resolved better.
Let me explain the problem I encounter first:
I think the key problem is that the proxy to pull images and the proxy for container(vpn passthrough) shouldn't be mixed. They are completely for different purpose. Providing two separate setting might be a better solution.