Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #13: Get Docker for Windows and VirtualBox Working Together

docker-tips-and-tricks.jpg

Docker for Windows uses Hyper-V. Having Hyper-V installed prevents you from running VirtualBox or VMWare VMs. Here's a workaround.

Quick Jump:

If you’re using Docker on Windows and have Windows 10 Pro then you’re probably using Docker for Windows as it’ll provide you the best Docker experience out of the box.

But you’ve probably noticed that you can’t run VirtualBox or VMWare anymore. That’s because Docker for Windows uses Hyper-V which is a type 1 hypervisor where as VirtualBox and VMWare are type 2 hypervisors.

Just having Hyper-V activated will prevent VirtualBox and VMWare from being able to start a VM (even if Docker for Windows is stopped).

You would have to uninstall Docker for Windows and disable Hyper-V to run VirtualBox, but there is another way. It’s not the best solution ever, but it’ll work in the end. If you need to support legacy VM based applications then a working solution is all you need.

It involves creating a second boot option and then rebooting every time you need to access your legacy VM. I learned about this when one of my Dive Into Docker students asked if there’s a way to run both together. I made it my life’s mission to find a solution.

Here’s what you need to run from a command prompt to enable this solution:
# Copy your GUID that was created, in this case it's "ff-23-113-824e-5c5144ea".
C:\>bcdedit /copy {current} /d "No Hyper-V"
The entry was successfully copied to {ff-23-113-824e-5c5144ea}.

# Replace "ff-23-113-824e-5c5144ea" with the GUID generated from the above cmd.
C:\>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off
The operation completed successfully.

This strategy was originally found on Scott Hanselman’s blog. Thanks for the solution Scott!

When you’re ready to make the switch:

  1. Goto your start menu
  2. Click the power button
  3. Hold down the Shift key
  4. Select the “restart” option and reboot

At this point you’ll be presented with a menu where you can choose “Use another operating system”. Then simply pick the “No Hyper-V” option that we made before and voila, you can start VirtualBox or VMWare up like normal without having to uninstall Docker for Windows.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.



Comments