Yes, You Can Run Docker AND Virtualbox on Windows 10 Home

Crane lifting up container in yard

By Al Crowley, TCG Principal Engineer

Running Docker containers on a Windows 10 PC has been difficult for the last few years. It’s even more difficult if you want to run VirtualBox virtual machines (VM) at the same time. A casual Google search will turn up droves of postings saying that you absolutely can not do both at once.

The problem is that Docker on Windows required you to enable the Hyper‑V hypervisor but VirtualBox 5.x will not run while Hype‑V is active. The docker+VM on Windows OS question has been asked and answered so many times over the years that search results are flooded with the same outdated answer: No, you can’t have both. For some of us, this gets further complicated by people saying you can’t even use Hyper‑V at all on the Windows 10 Home version. Well, things are changing — but you have to really dig deep on the web to get the info you need to make it happen.

Two recent changes have turned things around. First, VirtualBox 6 has an ‘experimental’ support for Hyper‑V. Second, the upcoming Windows Subsystem for Linux version 2 fully supports docker using Hyper‑V, even on Windows Home edition.

WSL2
Windows Subsystem for Linux (WSL) is really great for developers who want to install Windows on their PC. It allows you to install a Linux as a peer operating system to Windows that you can easily access through a Linux terminal. WSL version 1 did have some limitations though. A big one for me is that the system call emulation layer Microsoft provides could not support Docker.

WSL2 is big update—faster file system, support for directly running the Linux kernel on Hyper‑V. It is scheduled for the “20H1” update that will be released in the spring of 2020—but you can get it now if you join the Windows Insider program. Instructions for that are found in the Windows Insider Program User Guide. Once you have an updated version of Windows, install of WSL2 is easy enough if you follow the instructions on Microsoft’s website.

VirtualBox 6
Installing VirtualBox 6 is simple and you can find the install on the VirtualBox download page. It can be a little tricky to get some VMs running now that you have Hyper‑V enabled. For me, when I tried to restart an old VM, or create a new one using the defaults, I would get an error right away.

Alert window showing Virtual Box error message: "Failed to open a session for the virtual machine hypertest."

To get your VMs working, you will need to go into the VM settings, choose the System section, go into the Acceleration tab, and select Hyper‑V as the Paravirtualization Interface. You may also have to disable the I/O APC checkbox on the Motherboard tab. I’ve found some guest OS crash with it checked, but if it works for you, then leave it as is. THEN, you need to add an obscure setting to the .vbox file associated with your VM image:

VBoxManage setextradata "<VM Name>" "VBoxInternal/NEM/UseRing0Runloop" 0

I found that tip about the UseRing0Runloop setting on a forum posting that I was lucky enough to stumble upon.

Performance/Stability
This is working for my setup. Running with these beta test level features does have a few downsides. The VirtualBox VM performance is noticeably slower running this way. It is also a little unstable and you will get intermittent guest OS crashing that you didn’t have before. That’s ok for me since I’m using this for development work so it’s easy enough to restart the VM when it happens. On the WSL side, version 2 is a big improvement. Anything that touches the filesystem is much, much faster. Then we have Docker support, of course, which is why I went through all this in the first place. Unfortunately, I am seeing that some base container images will crash on Docker. I’ve found Centos to be problematic, but Ubuntu works without a problem. Microsoft is still working on WSL2 and judging by the forums, container support is getting better.

This is most definitely not a good fit for most people, but for me, this is an improvement over my old setup. The instability is a little annoying at times. As of right now, January 2020, every component is still in development: Fast ring Insider version of Windows 10, beta version of WSL2, and experimental support for Hyper‑V in VirtualBox. With that said, I’ve been able to do things with Docker containers and WSL that were just not possible a few months ago—and I really like that.