Use Docker Behind Proxy on Windows 8
1 min read

Use Docker Behind Proxy on Windows 8

Use Docker Behind Proxy on Windows 8

The other day I had to install Docker at work, aka behind a corporate proxy (on Windows 8).

While the docker installer is stand-alone and all is good, dealing with the VM is a different matter... The problem popped up when I tried to create a Django image and pip install failed miserably. To get around, you need to create a docker machine:

docker-machine create -d virtualbox \
    --engine-env HTTP_PROXY= \
    --engine-env HTTPS_PROXY= \
    --engine-env \

You also need to pass in the proxy as a build argument to build:

docker build --build-arg https_proxy=""

You can also pass the build argument to docker-compose but, in this case, you need to specify the services.


To make my life easier, I've built an alias for my bash command line:

alias docker_build="docker build \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--build-arg no_proxy=$no_proxy \
--build-arg HTTP_PROXY=$http_proxy \
--build-arg HTTPS_PROXY=$https_proxy \
--build-arg NO_PROXY=$no_proxy"

where $..._proxy are my environment variables.

Note: I've noticed it works also if you have a user/password-type proxy authentication. In this case, your environment variable:

http_proxy=http://user:[email protected]:8080/

would also be OK.