Docker for Windows

Docker for Windows is now in preview. Read on to learn why this is the best way for Windows IT Pros and developers to run Docker containers.

More...

Docker Toolbox is the existing solution to run Docker on Windows and Mac. It’s uses Oracle VirtualBox, which is its biggest weakness.

I have not been able to get VirtualBox working on recent Windows 10 builds, no amount of reinstalling and troubleshooting has helped. The VirtualBox error incidentally was "Cannot rename this connection.  A connection with the name that you specified already exists".  This has meant Docker Toolbox has been a dead-end for me, so I was super keen to learn about Docker for Windows.

The big news out of the gate, is Docker for Windows doesn’t use Oracle VirtualBox at all. Why use a third party virtualization solution, when one is built into Windows? That’s right Docker for Windows uses Hyper-V. This alone is a major boon, I know VirtualBox has its fans but it’s the only reason I had it installed, to support Docker Toolbox.

Docker for Windows features

Here is the official list of features

  • Faster and more reliable - No more VirtualBox! Docker Engine runs a xhyve VM on top of an Alpine Linux distribution.  On Windows the Docker Engine is running in a Hyper-V VM.
  • Native apps for better tools integration - Docker for Mac and Docker for Windows are native applications, including native user interfaces and the ability to stay updated automatically. The Docker tools are bundled with these apps, including the Docker command line interface (CLI), Docker Compose, and Docker Machine
  • Use with Docker Toolbox and Docker Machine - Docker for Mac and Docker for Windows can be used at the same time as Docker Toolbox on the same machine.
  • Volume mounting for your code and data - Volume data access is fast and works correctly.
  • Support for multiple architectures out-of-the-box - Docker for Mac and Windows lets you build and run Docker images for Linux x86 and ARM.

See Docker for Mac and Docker for Windows in action in this video

What to know before you install

​Signing up for the beta takes some patience, it took a few weeks for my invite to come through:

​You can sign up for Docker for Mac and Docker for Windows private beta today. This is a limited availability private beta and signing up will add you to a waiting list. We will add more people from the waiting list on a rolling basis as we get feedback and improve the product quality.

Docker will send you an email when you have been accepted into the beta with a subject of "Docker Private Beta - Token and Download included!".  This has a link to the installer and documentation.

​Only certain versions of Windows are supported:

​The current version of Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later). In the future we will support more versions of Windows 10.

The getting started guide says that VirtualBox will no longer work after installation, so the point about running Docker for Windows alongside Docker Toolbox may be moot.  To switch back to Docker Toolbox would require disabling Hyper-V.

If Hyper-V isn't already enabled the installer will enable this for you during the installation.

Installing Docker for Windows

Installation was really quick, around 15 seconds on my Surface Pro 3.  There weren't any options or anything notable, just run InstallDocker.msi to start the installation. 

At the end, after I selected the option to start Docker, I got this prompt, which was expected. I purposely didn't enable Hyper-V myself, as I wanted to see how Docker handled it.  This is the article lined to by the way for the manual Hyper-V install - Install Hyper-V on Windows 10.

Docker for Windows

I went with "Install & Restart", this was the longest part of the process, getting Hyper-V on as Windows went through the process.  On my Surface Pro 3 I did install Hyper-V beforehand but I still got prompted, as I hadn't installed the Hyper-V Module for Windows PowerShell.

Afterwards, I got ​the prompt to enter my invite token.

Docker for Windows

Then quickly afterwards, I got a prompt that installation was successful.  That was easy enough, certainly a lot nicer than Docker Toolbox and the hassle of VirtualBox.

Here is the welcome message, the start menu items that are created and the options from the Docker system tray.​

Docker for Windows

I can now get a working setup on my Surface Pro 3, it installed fine, but I couldn't get as far as the welcome screen.  It got stuck with "Docker is initializing".  This was fixed after upgrading to Beta 12.

If you have been using Docker Toolbox, you can import your work from their and bring in those images and containers.

Docker for Windows

Running Docker for Windows

I'd been impressed up until this point and it was going all so well until I tried running an actual docker command.  Running any docker command brought up this error

Error response from daemon: dial tcp 10.0.75.2:2375: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

There are other reports on the forum about this issue that didn't really yield any answers. I am not sure how I fixed it, apart from using the reset to factory defaults option and turning off the firewall.  After a reboot I could run docker commands, as shown below.

Running my first container

So now time to kick the tires​, running a very simple web app

docker run -d -P training/webapp python app.py

Here is what it looks like when run

Lets run 'docker ps' to find out the networking details.  The ports field shows the IP address of the virtual host as well as port and how it binds to the container. On Docker Toolbox, you had to hunt for the underlying IP address, so this is much more convenient. 

Opening this shows the container is running and we can communicate with it:

Docker for Windows

Using docker.local on Macs or just docker on Windows will work as well which automatically resolve to the docker machine. In this case it resolves to 10.0.75.2.

Docker for Windows Dashboard

What about a graphical way to manage your containers? There is a Dashboard option on the Docker system tray icon:

Docker for Windows

Sounds exciting, a native graphical user interface for Docker but right now you have to click the download button.  This will grab a zip file for Kitematic, you can expand and run as it is.

Docker for Windows

Docker for Windows and Hyper-V

A a virtual machine​ called MobyLinuxVM is setup during installation:

Docker for Windows

A Virtual Switch is configured as well called DockerNAT:

Docker for Windows

The virtual machine resources can be changed via the Docker system tray icon, Settings --> Change VM Settings. MobyLinuxVM is setup with 2 GB of RAM by default and two vCPUs.

Docker for Windows

Docker will run in the background at startup but you can turn this off in the settings.

Docker for Windows Closing Thoughts

Docker for Windows is going to be awesome but it's definitely not ready for prime time just yet.    It's understandable with a new beta version around once a week, it's going to take some time for the development to settle down.  

In all fairness it's hard to blame some of these issues, when their running on Windows 10 pre-release insider builds.  Talk about cutting edge. 

Already though, it shows huge promise and is a big improvement compared to Docker Toolbox.  I'll be following the developments closely and posting more, so stay tuned.  In the meantime why not check out my Ultimate WordPress Docker setup guide and learn how I use Docker to host this very site.