Boot2Docker on Hyper-V


Boot2Docker is a minimal (27MB) Linux image for running Docker. I started using it yesterday whilst investigating Docker on Mac OS X.

It’s designed to work with VirtualBox, and comes with a script to control the lifecycle of the Boot2Docker VM inside of VirtualBox. There’s no reason however why it shouldn’t be used with other types of virtualisation. As I have a Hyper-V server to hand I thought I’d give it a go on that.

Getting started

I downloaded the latest ISO (v0.54 at the time of writing). Created a new VM with 1GB RAM and a legacy network adaptor [1], and attached the boot2docker.iso file as a DVD drive. This booted up fine, and I could do Docker stuff.

Need persistence

There’s not much point to doing Docker stuff unless you can keep it around. So I needed a persistent disk.

I created a new dynamic VHD called b2d_base.vhd and attached it to the VM on the IDE controller. After starting up again I ran through the following commands:

sudo fdisk /dev/sda
<enter for default start>
<enter for deafult end>
<enter for default start>
<enter for deafult end>
sudo mkfs.ext4 -L boot2docker-data /dev/sda5

I then shut down the VM, removed b2d_base.vhd and created a new differencing VHD b2d1.vhd based on b2d_base.vhd and attached that to the IDE controller (so if I choose to make more VMs like this I don’t need to bother with the partitioning, formatting and labelling again).

Trying it out

I booted up again and ran:

docker run -d -p 1880:1880 cpswan/node-red-0.5.0t

Once that completed I could then browse to the NodeRed IDE on http://vm_ip:1880 :)

A quick look at my b2d1.vhd showed that it had grown to 914MB – so the persistence on a differencing disk was working.


[1] First time around I used a regular network adaptor, but boot2docker doesn’t have the drivers for that. With a lot more effort I could probably build my own boot2docker with a customised kernel and the right module. For the time being I’ll live with slightly worse network performance.

6 Responses to “Boot2Docker on Hyper-V”

  1. Good job

    Which driver did you use? We left all the network drivers from Linux 3.12.1 in the image, so they should be there. But I recommend you use virtio if you can, for performance reasons :)

    Also, if you can work out the patches needed, we’ll gladly include them.

    • The driver that I’m using for the legacy adaptor is tulip.

      The paravirtualised adaptor needs hv_netvsc (which in turn needs hv_vmbus). At this point it’s probably in for a penny in for a pound, and throw in hv_storvsc, hv_utils and hid_hyperv to get full PV support on Hyper-V.

      It should just be a case of enabling those when configuring the kernel (I’d guess that they’re off by default).

      This post ‘Installing Hyper-V PV Drivers for Linux Guests‘ provides some decent background. The official MS stuff about ‘Linux Integration Services‘ is basically useless (as is their github repo) as it’s all targeted at Enterprise Linux.

  1. 1 Getting Docker Running on Hyper-V 8.1/ 2012 R2 | CloudExpert Tackling your needs for success
  2. 2 Getting Docker Running on Hyper-V 8.1/ 2012 R2 - Shawn Cicoria - Site Home - MSDN Blogs
  3. 3 Getting Docker Running on Hyper-V 8.1/ 2012 R2 - Shawn Cicoria - CedarLogic
  4. 4 Running Docker on Hyper-V |

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: