Categories
Windows

How to run Docker and VirtualBox at the same time on Windows

I’m usually using Ubuntu for development with Docker and VirtualBox, but I’ve recently started using Windows 10. Docker and VirtualBox can’t be used at the same time if Hyper-V is used.

Hyper-V runs Windows virtualized, so other virtualization software can’t be used at the same time. This is how and why I switched to docker-machine instead so I could run docker and VirtualBox at the same time.

Uninstall Docker and disable Hyper-V (if installed)

If you have Docker installed, then you need to remove it.

Then disable Hyper-V by pressing the Windows key and search for Turn Windows features on or off. Remove the checkbox on Hyper-V if it’s enabled.

Open an elevated shell by pressing the windows button and search for PowerShell. Right-click it and runs it as administrator.

Run the following command:
bcdedit /set hypervisorlaunchtype off

Then reboot.

Make sure Intel VT-x or AMD SVM is enabled

Press CTRL + ALT + DELETE and then Task Manager. Check if it says virtualization enabled as shown below.

How task manager looks if virtualization is enabled.
It should say enabled if VT-X or AMD SVM is enabled.

If it’s not enabled then you need to enable it in your BIOS.

Install VirtualBox

You can download VirtualBox from the official site and install it.

Install Docker Toolbox

We’re going to use Docker Toolbox to run docker in virtualbox.

The official guide found here has some issues, at least on AMD hardware. It keeps complaining about virtualization not being enabled when it is, so we need to make a small modification to disable the virtualization check.

  1. Download Docker Toolbox from GitHub.
  2. Run the install file you just downloaded.
  3. Open Notepad as administrator and open the file C:\Program Files\Docker Toolbox\start.sh. Make sure you select “all files” if you can’t find it.
  4. Find the line "${DOCKER_MACHINE}" create -d virtualbox $PROXY_ENV "${VM}" and replace it with "${DOCKER_MACHINE}" create -d virtualbox --virtualbox-no-vtx-check $PROXY_ENV "${VM}".
  5. Save the changes.
  6. Start Docker Quickstart Terminal.

Docker should now be working, and you can continue following the official guide from step 3.

Have fun with Docker and VirtualBox at the same time, and a faster Windows experience as Windows no longer runs virtualized 😊

Leave a Reply

Your email address will not be published. Required fields are marked *