Using Docker with VirtualBox and Windows 10

Image for post
Image for post
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

  • 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:

Image for post
Image for post

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

Image for post
Image for post

2 — Choose Advanced System Settings

Image for post
Image for post

3 — To go Environment Variables

Image for post
Image for post

4 — You need to add the following variables:

DOCKER_HOST

Image for post
Image for post

and use the following format

tcp://<IP>:2376

Example:

tcp://192.168.99.100:2376

DOCKER_TLS_VERIFY

DOCKER_CERT_PATH

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).

Image for post
Image for post

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

Testing docker

docker run hello-world

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

Image for post
Image for post

And if you do a

docker images

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

Image for post
Image for post

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

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store