The 5 minute guide to running Docker on Windows with Hyper-V
Ok lets go ahead and quickly get started. I am including the time this blog takes to read as part of the five minute setup.
Quick Background
Dockers is a first class panting solution built for the Linux sysadmin- jk. Didn't think we had times for jokes in these five minutes did you?
Anyways real answer is Docker is an open source project that standardizes and layers application stacks in a convenient, portable container. More info
Requirements
In order to run this guide you need Windows 7, 8, 8.1, or 10 Pro edition, that is capable of running Hyper-V. To check if Mom sprung for the Pro edition, open up the start menu/bar/controversy/screen and search for System. Open that panel up and check what version you have under Windows Edition
Sweet I have Windows 10 Pro; I can write this blog; lets keep going
Steps
- Turn on the Hyper-V Feature if not activated (1 - 2 minutes), includes a restart
- Create a Virtual Network Switch in Hyper-V Manager (1 minute)
- Download and run a docker-machine command (30 seconds)
Hyper-V
To turn on Hyper-V, search Turn Windows features On or Off, and play some soothing jazz ;) (4/10 joke). Once the menu is loaded click the check box next to Hyper-V
Your computer will prompt a restart. Do it, Do it now.
Virtual Network Switch
Jeez that took a while, time for an SSD upgrade? Ok Virtual Network Switch Time. Open up the start menu, and search Hyper-V Manager. Open that panel up and on the right hand side under Actions click Virtual Switch Manager
Once open select External and hit Create Virtual Switch. In the new pane change the name to whatever you like, and select the Network Adapter you are currently using.
Docker time
Ok at this point we should be hitting right around 3~4 minute mark, lets go and grab docker-machine which is going to be used to provision a Docker host. Docker-Machine can be found here, and the direct docker-machine download for Windows 64-bit can be found https://github.com/docker/machine/releases/download/v0.4.1/docker-machine_windows-amd64.exe.
Go ahead and grab that file as fast as your network allows (size is 12.1 MB). We have no time for renaming and moving that binay, we need to open up Administrative Command Prompt.
Hit Windows Key and type cmd, before opening him up -- right click his icon and click Run as Administrator.
Once command prompt is up, type cd
commands to switch into the folder you downloaded docker-machine. Most likekly can run the following :cd C:\Users\<your username>\Downloads\
. Now go ahead and type the following command to use docker-machine
docker-machine_windows-amd64.exe create -d hyper-v --hyper-v-virtual-switch <YOUR VIRTUAL SWITCH NAME> <YOUR CUSTOM MACHINE NAME>
Now as we wait some background. Docker-Machine is a part of the Docker toolset that quickly enables you to deploy a Docker host across a variety of mediums including Hyper-V, Microsoft Azure, Google Compute Engine, AWS, yada, yada, yada.
In our case we made use of the Hyper-v driver. The Hyper-V driver goes out and downloads the boot2docker.iso, mounts it, and starts the VM with the switch created. Now should have a running Docker host in Windows.
You can now open up the Virtual Machine in Hyper-V Manager for the following view, and start running Docker commands.
Sweet did we make five minutes?