Docker on Windows behind a Corporate Proxy with Authentication

Docker on Windows behind a Corporate Proxy with Authentication

The following steps describe how to get Docker on Windows working, when you are behind a Corporate Proxy which requires Authentication.

First Step – CNTLM Proxy

The first step is to install the tool CNTLM Proxy to circumvent the Authentication issue.

In the config file of the CNTLM tool you have to configure:

  • Username – Username for Proxy-Authentication
  • Domain – Your (Windows-)Domain for Proxy Authentication
  • Password – Your password for Proxy Authentication
  • Proxy – Your corporate proxy
  • Listen – Local Port the CNTLM tool is listen to (e.g. 3128)

If you don’t want to save your Username/Password in clear text in the config file, use the command “cntlm -H” to get an encrypted version of these information you can use in the config file.

After the tool is started and running, you should check whether it is running properly, e.g. using a Browser and setting the HTTP-Proxy to “localhost” and Port to the Listen Port of CNTLM (e.g. 3128).


Second Step – Create a Docker Machine

To let the docker-machine command download the boot2docker.iso it has to use your local proxy installed in the first step.

If you are using the Docker CommandLine (Docker Quickstart Terminal), run the following commands:

  • http_proxy=”http://localhost:3128″
  • https_proxy=”https://localhost:3128″
  • export http_proxy https_proxy

If you are using the regular Windows CMD-Prompt, run the following commands:

  • set http_proxy=http://localhost:3128
  • set https_proxy=http://localhost:3128

After setting the proxy environment variables you can run:

  • docker-machine create -d virtualbox –engine-env HTTP_PROXY= –engine-env HTTPS_PROXY= default-withproxy

to create your Docker-Machine Image.

IMPORTANT: The arguments –engine-env have to be used! Via the IP address “” the Docker Daemon within your Docker-Machine Image running in the VirtualBox can access the CNTLM proxy, which is running on your Windows-Machine.

To use the created Docker-Machine from your docker commands run:

  • docker-machine env default-withproxy

and execute the last line from the output in your command window.


Third Step – Run an existing Docker Container

Now you should be abled to run an existing Docker Image from the central Dockerhub Repository, e.g.:

  • docker run ubuntu /bin/echo ‘Hello World’


Fourth Step – Build your own Docker Container 

If you want to build your own image from your Dockerfile, you have to add proxy specific arguments so wget/apt-get/… calls in your Dockerfile use your local CNTLM proxy, e.g.:

  • docker build –build-arg http_proxy= –build-arg https_proxy= -t tiews/mongodb .


Have Fun With Docker!


Leave a Reply

Your email address will not be published. Required fields are marked *