Modifying Kitematic to run on Windows 10 with Hyper-V

Kitematic is a new player in the Docker arsenal, and fully featured with Docker's release of the new Toolbox. Kitematic has two basic principles

  1. Give everyone a streamlined process to spin up and try Docker on their local machine
  2. Bring a delightful UI experience to the the container world

As most enthusiasts, when I saw this announcements I rushed onto the release page and began my Windows download. After I ran the installer I was shot into a Virtual Box installer and was up and running in seconds - Awesome. Now when I updated to Windows 10, I started with a clean slate, and Kitematic was unfortunately lost in the fire.

When I installed Kitematic again on Windows 10, I and many other users found that Virtual Box did not work on Windows 10. Forced to fend for myself I turned to my holy hypervisor savior Hyper-V. I love Hyper-V; for one it's installed on my machine by default, all my friends run Hyper-V, even my mom runs Hyper-V.

Anyways, I found that docker-machine had a pleasant experience with Windows 10 Hyper-V, and that if Kitematic used that same logic for docker-machine on Virtual Box I could simply switch the underlying docker-machine command. This blog is about the foolish endeavor to turn the streamlined process of running Kitematic, into a process full of long and complicated twists and turns.

Chapter 1: Bring down the code

In order to get Kitematic running on Hyper-V I needed to get the source, and change two files. If interested these are the two files. I also changed this file that removes the steps for downloading and installing virtualbox Git Hub change. The main changes are to the docker-machine line that changes the driver from Virtual Box to Hyper-V.

The new command hard coded is docker-machine create -d hyper-v --hyper-v-memory 512 machineName.

Chapter 2: Build kit and they will come

Now to get this custom Kitematic build up and running we need to build the changes made from the previous section. Here is where documentation is our best friends, and we have to go execute the task of download pre-requisites. Straight from the docs

  1. Node.js 0.10.38
  2. The following directory AppData\Roaming\npm in your root folder - most of the time is C:\Users\<Username>
  3. Visual Studio 2013 (or similar) - You do not need to install any optional packages during install.
  4. Python 2.7

Additionally, you need to have Git installed.

Node.js

Installing Node.js is pretty simple. Go to the webpage and download the appropiate package, run through the steps. Here's the straight node-v.10.38-x86.msi link.

Directory

To make the proper directory open up command prompt and cd C:\Users\<Username> then mkdir \AppData\Roaming\npm -- might already exists as well

Python

Installing Python is also trivial , download and run the installer - and you should be good to go. I have only tried with Python 2.7 and cannot comment about other version compatibility.

Visual Studio 2013

Since I am a serial software downloader (I'm the guy with 3+ search toolbars) I already had Visual Studio 2015. Unfortunately, using a version of VS 2013+ I would run into the following error, when trying to build
Error

In order to get this build working I had to get Visual Studio 2013 Community from https://go.microsoft.com/fwlink/?LinkId=532495&clcid=0x409. During install only select the Foundation C++ piece, and leave all the other "goodies" for another time.

Hyper-V Network Adapter

As docker-machine with Hyper-V uses the first Virtual Network Switch Hyper-V lists we want to make sure that this Virtual Network Switch is ready to go when Kitematic spins up. Open up Hyper-V Manager and then open Virtual Switch Manager on the right pane under actions.

RightPane

After opening this window up create a New External Network Switch and configure the link with your actual Network Adapter

PortConfig

Now we can build

Open up the Node.js command prompt with Admin rights, right click and Run As Admin. change into the Kitematic root directory and run npm install npm-gyp first and then run npm install. After install is complete go ahead an run npm run start.

Woohoo we should now have a dev image of Kitematic starting up telling us its out and about starting up "Virtual Box" (I won't tell Kitematic if you don't). At this point open up Hyper-V Manager and you should see the "default" VM popup.

HyperVManager

Hopefully the docker-machine config goes ok and you are left with the following VM and Kitematic screen

Proof1

I'll sign in and go ahead and create a Ghost blog in a container, along with the hello-world-nginx. The main features of showing mounted volumes, logs, and downloading containers all works great.

Proof2

And there we go - we now have a fairly fragile Kitematic instance running on top of Hyper-V. Adding the fragile statement, you will need to remove the VM after you shutdown Kitematic or you will run into SSL errors.

Now hopefully Virtual Box for Windows 10 gets fixed soon, but until then party on with Kitematic on Hyper-V.