Docker Machine on Windows – How To Setup You Hosts

I’ve been playing around with Docker a lot lately. Many reasons for that, one for sure is, that I love to play around with latest technology and even help out to build a demo or two or a lab. The main difference, between what everybody else of my colleges is doing is, that I run my setup on Windows. Like most of the middleware developers out there. So, If you followed Arun’s blog about “Docker Machine to Setup Docker Host” you might have tried to make this work on windows already. Here is the ultimate short how-to guide on using Docker Machine to administrate and spin up your Docker hosts.

Docker Machine

Machine lets you create Docker hosts on your computer, on cloud providers, and inside your own data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them. You basically don’t have to have anything installed on your machine prior to this. Which is a hell lot easier, than having to manually install boot2docker before. So, let’s try this out.

You want to have at least one thing in place before starting with anything Docker or Machine. Go and get Git for Windows (aka msysgit). It has all kinds of helpful unix tools in his belly, which you need anyway.

Prerequisites – The One For All Solution

The first is to install the windows boot2docker distribution which I showed in an earlier blog. It contains the following bits configured and ready for you to use:

  • VirtualBox
  • Docker Windows Client

Prerequisites- The Bits And Pieces

I dislike the boot2docker installer for a variety of reasons. Mostly, because I want to know what exactly is going on on my machine. So I played around a bit and here is the bits and pieces installer if you decide against the one-for-all solution. Start with the virtualization solution. We need something like that on Windows, because it just can’t run Linux and this is what Docker is based on. At least for now. So, get VirtualBox and ensure that version 4.3.18 is correctly installed on your system ( VirtualBox-4.3.18-96516-Win.exe, 105 MB). WARNING: There is a strange issue, when you run Windows itself in Virtualbox. You might run into an issue with starting the host.

And while you’re at it, go and get the Docker Windows Client.  The other is to grab the final from the test servers as a direct download (docker-1.6.0.exe, x86_64, 7.5MB). Rename to “docker” and put it into a folder of your choice (I assume it will be c:\docker\. Now you also need to download Docker Machine, which is another single executable ( docker-machine_windows-amd64.exe, 11.5MB). Rename to “docker-machine” and put it into the same folder. Now add this folder to your PATH:

set PATH=%PATH%;C:\docker

If you change your standard PATH environment variable, this might safe your from a lot of typing. That’s it. Now you’re ready to create your first Machine managed Docker Host.

Create Your Docker Host With Machine

All you need is a simple command:

docker-machine create --driver virtualbox dev

And the output should state:

←[34mINFO←[0m[0000] Creating SSH key...
←[34mINFO←[0m[0001] Creating VirtualBox VM...
←[34mINFO←[0m[0016] Starting VirtualBox VM...
←[34mINFO←[0m[0022] Waiting for VM to start...
←[34mINFO←[0m[0076] "dev" has been created and is now the active machine.
←[34mINFO←[0m[0076] To point your Docker client at it, run this in your shell: eval "$(docker-machine.exe env dev)"

This means, you just created a Docker Host using the VirtualBox provider and the name “dev”. Now you need to find out on which IP address the host is running.

docker-machine ip

If you want to configure your environment variables, needed by the client more easy, just use the following command:

docker-machine env dev
export DOCKER_CERT_PATH="C:\\Users\\markus\\.docker\\machine\\machines\\dev"
export DOCKER_HOST=tcp://

Which outputs the Linux version of environment variable definition. All you have to do is to change the “export” keyword to “set”, remove the ” and the double back-slashes and you are ready to go.

C:\Users\markus\Downloads>set DOCKER_TLS_VERIFY=1
C:\Users\markus\Downloads>set DOCKER_CERT_PATH=C:\Users\markus\.docker\machine\machines\dev
C:\Users\markus\Downloads>set DOCKER_HOST=tcp://

Time to test our Docker Client

And here we go now run WildFly on your freshly created host:

docker run -it -p 8080:8080 jboss/wildfly

Watch the container being downloaded and check, that it is running by redirecting your browser to

Congratulations on having setup your very first docker host with Maschine on Windows.

Markus Eisele

Markus is a Developer Advocate at Red Hat and focuses on JBoss Middleware. He is working with Java EE servers from different vendors since more than 14 years and talks about his favorite topics around Java EE on conferences all over the world. He has been a principle consultant and worked with different customers on all kinds of Java EE related applications and solutions. Beside that he has always been a prolific blogger, writer and tech editor for different Java EE related books. He is an active member of the German DOAG e.V. and it's representative on the iJUG e.V. As a Java Champion and former ACE Director he is well known in the community. Follow him on Twitter @myfear.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button