Docker for Windows – Getting a Docker 1.12 Swarm running in minutes

3
Docker 1.12 Orchestration - four features - swarm mode
Docker 1.12 Orchestration - four features - swarm mode

Today we are going to show how to setup Docker for Windows and two Ubuntu virtual machines on a Windows 10 desktop to create a cluster where we can define services and schedule them to run. Docker 1.12 introduced a few new features which are very exciting. First, Docker for Windows utilizes a Hyper-V Linux virtual machine to host a Docker installation. The Docker and Microsoft teams have integrated this into Windows 10 to the point t hat one can run Docker services directly from the PowerShell or standard Windows command line.

Docker 1.12 is also the first release with a native Swarm option built-in. With the Docker Swarm mode in version 1.12 one can create Swarm clusters for managing services across virtual machines and bare metal nodes directly from the base Docker Engine installation. If you were thinking of setting up a Raspberry Pi docker cluster (check Hypriot for this), you can instead use a Hyper-V virtual environment on an Intel NUC, notebook PC or a standard desktop PC and have a faster/ cheaper 0-5 node “cluster” with more RAM.

Here are the pre-installation steps we did:

  1. Install Docker for Windows on our base system. Here is the guide you need. This is as simple as running the executable and restarting the PC if you did not have Hyper-V installed. The Docker for Windows installer will guide you through this. If you do have issues with Hyper-V installation, there is a BIOS setting to enable Intel VT-x virtualization (or equivalent on other architectures) which you should ensure is enabled. This should take 2-5 minutes.
  2. Ensure you have proper RAM/ CPU allocations for Docker for Windows and for the two Ubuntu VMs. This should take you 1 minute to complete.
  3. Setup two Ubuntu 16.04 LTS Hyper-V VMs. We used our standard base server installation with OpenSSH server also installed just to make this process easy. There are many other OSes available but Ubuntu works relatively well in Hyper-V so that is what we are using. Even installing from an ISO this will take no more than 5-10 minutes.
  4. Install Docker 1.12 on the Ubuntu VMs (guide here.) Which should take around 2 minutes.
  5. Connect to the Ubuntu VMs (we are using OpenSSH and Putty) and a Windows command prompt or Windows Power Shell. This should take about 1 minute.

With a bit of multi-tasking, you should be able to get the above complete in around 10 minutes. It will be a bit faster if you are a Hyper-V guru with pre-made templates and could take a few minutes longer if you are completely new to Hyper-V.

Docker for Windows Hyper-V VM
Docker for Windows Hyper-V VM

We made a short video using the above demonstration to show how easy the new Docker Swarm mode is. Creating a cluster takes seconds and Docker handles bits like encryption.

As you can see in the 144 second video we initialized a three node Docker Swarm cluster. We defined a simple service and then verified that the service was scheduled and running on two of the three cluster nodes. Using many traditional clustering solutions, this would have taken hours of setup time. Docker for Windows and Docker 1.12 are game changing in how easy they are to get running.

If you were to spend a nominal amount of additional time, and had sufficient RAM, you could easily scale the Swarm cluster out to 8-16 nodes by adding more Ubuntu VMs. Working in a virtual world is great, however the next step is moving this proof of concept into something usable: a bare metal cluster sitting in one of our data centers.

3 COMMENTS

  1. Not sure if you might be able to help me here. I created 3 nodes with docker-machine on my local and added them all to a swarm with 1 manager and 2 workers. They are all using an external network.

    After I installed Shipyard with their automated script: https://shipyard-project.com/docs/deploy/automated/ it will provide me the IP of the manager with port 8080 as a way to reach Shipyard. I try to use this in my browser, http://:8080 but I’m unable to reach Shipyard.

    Any ideas why this is the case? I ping the address and check in docker-machine ls and the IP is correct

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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