Docker on Windows with VMware Workstation and Vagrant

By | March 24, 2014



My company laptop is an HP Elitebook that runs Windows 7. I’ve requested a Macbook Pro in the past, but to no avail so I am forced for various reasons to spend the majority of my time living in a Windows world. This is usually not an issue and for the most part I think that Win7 is a fine business desktop. However it is in a issue in one very special circumstance that I find myself facing quite a bit.

How do I quickly build tests and demo software in Linux when I have no Internet connection.

This happens more that I thought it would. When I am on a plane, at a client, giving a presentation in a restaurant meeting room, all of these times I needed access to a quick shell to demo or test something and I was stuck. I knew my answer lied in Docker, but how to do it was another problem.

Partial Solutions and More Problems

The official Docker answer to this problem is to run  a Live CD image named boot2docker (available on github) on Oracle VirtualBox. Although this would work there were two issues:

First, the image could only be non-persistent. Admittedly Docker containers by their very nature are temporary, however the idea of not being able to save anything to disk easily was a non-starter. I wasn’t completely sure of why I would need to save to disk until later, but when I did need it I was glad the option was there.

Second, I was already running VMware Workstation 10 on my laptop with limited resources and wanted to avoid having to use VirtualBox as well. Mounting the Live CD inside an empty VM would not be hard, but it did not solve the persistence issue. Also, I would not have the other benefits of running a VM built for VMware.

The answer to my problem was to toss another turtle on the pile, Vagrant.

Three Turtles, One Solution

After a bit of research I settled on the following setup:

Vagrant using the VMware Workstation for Windows provider to spawn a customized Ubuntu Saucy Salamander (13.10) box running Docker and LXC. The Vagrant Box I am using is “ffuenf/ubuntu-13.10-server-amd64_lxc-docker” and is freely available from Vagrant Cloud. It includes Docker, LXC Linux Containers, and several common dev tools.

A Note About Cost: The VMware Provider for Vagrant costs 79 USD while the VirtualBox Provider is free and installed by default. I chose to pay the extra cost for “free” software because I believe that the added features, stability, and conserved resources merited the purchase. Also profits from the sale of the VMware Provider are funneled directly back into the support and future development of the Vagrant project and this is a worthwhile thing to support.

How It Works

For the sake of brevity I will assume that you already have VMware Workstation 10 installed and are connected to the Internet. (This config will work offline, however not the install.)

1. Download and Install Vagrant.

2. Reboot.

3. Purchase the VMware Workstation Provider here.

4. Hashicorp will email you instructions on obtaining the plugin and license file. Download both.

5. Open your preferred Windows Shell, both cmd.exe and PowerShell will work. In this tutorial I will be using Powershell.
Note: The shell must be Run As administrator.

6. Change directory to where you downloaded the plugin and license files.

7. Install the plugin with the following command:

vagrant plugin install vagrant-vmware-workstation

8. Install the license with the following command:

vagrant plugin license vagrant-vmware-workstation license.lic

9. Create a Vagrant root directory.

mkdir c:\vagrant
cd c:\vagrant

10. Initialize Vagrant.

vagrant init ffuenf / ubuntu-13.10-server-amd64_lxc-docker

11. Vagrant Up the machine.

C:\vagrant>vagrant up --provider=vmware_workstation

The first time the machine is brought up it will need to download the image. Depending on your connection this might be a little while. After the first time it will load from local disk and be much faster.

Note: The error regarding HGFS as seen above can be safely ignored as it is not needed.

12. Once the machine is up you will see the “vagrant:default” VM powered on and listed in the VMware Workstation Library.

13. SSH in to the newly spawned Virtual Machine.

vagrant ssh

You now have an open session with the Vagrant Ubuntu Virtual Machine.

14. As Docker is still considered Beta and under heavy development, we need to apply a fix for it work. Run the following commands:

sudo wget -O /etc/init/docker.conf
sudo service docker restart

15. Now launch Docker in interactive mode with your image of choice.

In this example I am using the bowery/mongo image. For a full list of available images check out the Docker Index.

docker run -i -t bowery/mongo /bin/bash

You now have a session with a fully functional Docker LXC container.

16. I’m going to want to do some MongoDB work so I will fork the server process and kick off a Mongo shell.

sudo ./mongod --fork --syslog


That’s it! Now when I exit the Docker shell, I can vagrant suspend or vagrant halt the Virtual Machine, and get back to it at when I am offline with just a vagrant up.

If you are going to work offline, just remember that you have to pre-stage any docker images you want to have available while online first. After you have the image downloaded it will be available to you.

For those of you following the SaltStack series, don’t worry there will more very soon. I assure you it will be worth the wait.

8 thoughts on “Docker on Windows with VMware Workstation and Vagrant

  1. Pingback: Docker on Windows with VMware Workstation and V...

  2. Pingback: Docker on Windows with VMware Workstation and V...

  3. Pingback: Docker on Windows with VMware Workstation and Vagrant | Dinesh Ram Kali.

  4. Matthew R. Versaggi

    Excellent post! How would the initial setup go if the vmware workstation was a different computer than the Vagrant computer and the install had to happen over the network?

  5. Alex Czarnowski

    Unfortunately it seems that ffuenf / ubuntu-13.10-server-amd64_lxc-docker isn’t available any more and boot2docker is also a deprecated option, but I would still like to run Docker under VMWare Workstation. Would be grateful for any tips since current Docker solution is still based on VirtualBox.

      1. Alex Czarnowski

        Thanks for the link. It looks very interesting but unfortunately it is still WIP but I’ll keep watching it. It seems that switching to Win 10 maybe a way to go with latest docker releases.

        1. dragon788

          Yes, if you can run Hyper-V and don’t need Virtualbox or VMware for other tasks Windows 10 definitely makes Docker for Windows a bit easier.


Leave a Reply

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