Using Docker with VirtualBox and Windows 10

Andrea Lettieri
Dec 12, 2017 · 4 min read
Docker Logo

Last year, I built a gaming PC, with a nice video card, a nice solid state drive, and 32 gigs of RAM. Since this PC was also going to be my work PC, I wanted to separate the games from the development tools that I need to use.

So I installed Oracle VirtualBox.

It was all nice and peachy (outside of some audio problems, and a couple of video problems), and I had all the development environment contained a virtual machine running Windows 10, hosted on another Windows 10 install.

Until I had to install Docker.

I tried to install it, and run it from inside VirtualBox, and I got this error message:

“This computer doesn’t have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory”

What does it mean? It means that you can’t run another virtualization environment inside VirtualBox, because VirtualBox does not support nested virtualization. So, I had two possible solutions:

1 — I could move to VMWare, but I have to reinstall everything

2 — I could run Docker on the host, and change the configuration to use the docker daemon from the host IP.

Because I’m complicated, I choose the 2nd option. And it’s not that hard! So, here are the steps that you need to take to make it work


Install Docker

To install Docker on Windows, you can’t install the regular and new Docker for Windows, because… you have Virtual Box installed!

  • Docker for Windows requires Hyper-V to work.
  • VirtualBox does not work with Hyper-V enabled.

See where I’m going with this? They are not compatible between them.

What a lovelly thing!

Thankfully, Docker has an older package, called Docker Toolbox, which is actually used for older Windows versions, that doesn’t have Hyper-V.

You just need to download Docker Toolbox and install it on your host computer.

If everything went smoothly, running the Docker Quickstart Terminal shortcut will display the following on your host:

As you can see, Docker is now running on your host computer!

Now you need to configure your virtual machine.

1 — Right click on your PC and choose Properties

2 — Choose Advanced System Settings

3 — To go Environment Variables

4 — You need to add the following variables:

DOCKER_HOST

Value: For this variable, use the IP that the Docker process in the host machine has displayed

and use the following format

tcp://<IP>:2376

Example:

tcp://192.168.99.100:2376

DOCKER_TLS_VERIFY

Value: 1 (this will use the certificates, which we will configure in a bit)

DOCKER_CERT_PATH

Value: the path where your certificates are stored. For this, you will need to copy the certificates that are located in your host’s config directory, located at

C:\Users\<user>\.docker\machine\certs\

There are 4 .PEM files there. Copy everything to a folder in the HD of your Virtualbox install, in any directory that you want (I will use G:\Keys\Certs as an example. I suggest that you use a directory that doesn’t have spaces on it).

And now set the value for the environment variable DOCKER_CERT_PATH to your directory (G:\Keys\Certs), without a trailing bar


Testing docker

To verify that Docker is actually correctly installed on both the host and the virtual machine, you can install Docker toolbox on the VirtualMachine as well (even when you won’t be using the server, just the client) and run the command:

docker run hello-world

You will see the following screen, if everything worked as expected

And if you do a

docker images

on the Docker toolbox on the host, you will see the image hello-world is running there

Let me know if this helped you! Or if you had issues, we’ll try to figure them out :)