Docker Notes

4 minute read

Notes on how to install Docker on Microsoft Windows and how to make it work if you also run VirtualBox on the same computer.

The official Docker documentation is available at https://docs.docker.com/. You can also refer to the getting started guide or if you are more comfortable with command line interfaces, refer to the Docker CLI reference.

Docker on Microsoft Windows

Running Windows Containers

To run Windows containers you need to install Docker on a Windows 64-bit machine using a professional or enterprise licence, running on top of hardware supporting Hyper-V.

If you meet those requirements, you can download and install the Docker Community Edition for Windows.

Note: If you use VirtualBox on the same machine where you plan to use Docker, VirtualBox will not be able to run virtual machines once you enable Hyper-V. This happens because hypervisors cannot run concurrently and Hyper-V runs all the time, so VirtualBox cannot run its own hypervisor. A workaround for this issue is discussed in the next section.

Running Linux Containers

If you only want to run Linux containers on a Windows machine, you do not need to have a professional or enterprise licence. All you need to have is Windows 10, version 1903 or higher or Windows 11 installed.

You then need to enable the Windows Subsystem for Linux (WSL) 2 feature on Windows, by following these Microsoft instructions. Furthermore, you need to download and install the Linux kernel update package.

More details can be found in the official Docker guidelines: Docker Desktop WSL 2 backend.

Running Docker and VirtualBox on Microsoft Windows

If you need to run VirtualBox machines from time to time on the Docker machine, you can use the boot configuration editor bcdedit to enable/disable Hyper-V.

To run VirtualBox machines

  1. Open a command line or a power shell as an administrator and type bcdedit.
  2. Under the Windows Boot Loader section there should be an entry hypervisorlaunchtype set to either off or auto.
  3. To disable Hyper-V type bcdedit /set hypervisorlaunchtype off and restart your computer.
  4. You can now use VirtualBox machines as usual.
    Note: If Docker is set to auto-start it will alert you that Hyper-V is disabled and hence it cannot run.

To use Docker

  1. When you finish using VirtualBox, you need to re-enable Hyper-V using bcdedit and restart your computer.
  2. So, open a command line or a power shell as an administrator and type bcdedit /set hypervisorlaunchtype auto and then restart your computer.
  3. On restart, Docker will work properly again.

Reference: Derek Gusoff: Run Hyper-V and VirtualBox on the same machine.