Monthly Archive for: ‘May, 2015’
Docker on Windows behind a Firewall
Working with Docker under Windows becomes easier and easier. I am often ask by co-workers how to run Docker behind a firewall, this blog gives a little recipe, how to set up the whole Windows/Docker/Firewall environment.
- Install Virtual Box
- Download Docker Machine to manage your docker hosts
- You find the Windows versions (32 and 64 bit) at above link
- Rename the exe to docker-machine.exe
- I would recommend putting the machine in a dedicated docker directory and update your PATH env variable
- Install the Docker Windows client
- You find it at https://get.docker.com/builds/Windows/x86_64/docker-latest.exe for 64 bit
- Or https://get.docker.com/builds/Windows/i386/docker-latest.exe for 32 bit
- Rename it to docker.exe and put it in the directory where you put the machine
- Create a Docker host named ‘dev’ with docker machine
docker-machine create --driver virtualbox dev
- Connect the Docker client with the docker vm
- Saving the environment to a .bat file:
docker-machine env -shell cmd dev > docker-env.bat
- You will get something like
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.2:2376
SET DOCKER_CERT_PATH=C:\Users\toedter_k\.docker\machine\machines\dev
SET DOCKER_MACHINE_NAME=dev
REM Run this command to configure your shell:
REM FOR /f “tokens=*” %i IN (‘docker-machine env -shell cmd dev’) DO %i - Run the bat file (or, like docker-machine tells you, you could run the code in the last line without the REM 🙂 )
- Check if the client is working:
- Run
docker ps
in a Windows cmd
- Run
- Saving the environment to a .bat file:
- Prepare the proxy settings
- SSH into the docker dev host:
docker-machine ssh dev
- Add the following lines to /var/lib/boot2docker/profile (this file is read-only, use sudo)
export HTTP_PROXY=http://<proxy>:<port>
export HTTPS_PROXY=http://<proxy>:<port> - Exit the ssh session and restart the docker machine:
docker-machine restart dev
- SSH into the docker dev host:
Now you should be able to use Docker on Windows behind a firewall. To test it, open a Windows cmd and run
docker run busybox echo hello world
After docker has downloaded the busybox image you should see
hello world
That’s it 🙂
Now you can easily use all Eclipse or IntelliJ IDEA plugins that require a local Docker installation.