Fixing Docker to run smooth on Windows

Alexander Lockshyn
Jul 4, 2018 · 3 min read

Few months ago I’ve described why Windows is awesome for software development now. However there were still a few major flaws and most of them were related to Docker for Windows:

  1. (NOTE: this issue is not relevant as of May 2019) Native Windows Docker is quite unstable, I had to reset its settings to default or even reinstall Docker completely every week or two.
  2. Native Windows Docker uses Hyper-V, which makes impossible using both Docker and VMWare/Virtualbox at the same time. Also it does not work on Windows Home edition.

Today we’ll go through solutions for these issues.

Docker Toolbox

Docker Machine is the heart of Docker Toolbox

Before native Windows Docker there was a cross-platform solution called Docker Toolbox. It is a docker machine (docker engine, that could run on different back ends) with bundled VirtualBox back end running minimalist Linux distribution, a set of additional tools.

Docker team tells following about Docker Toolbox:

Legacy desktop solution. Docker Toolbox is for older Mac and Windows systems that do not meet the requirements of Docker for Mac and Docker for Windows. We recommend updating to the newer applications, if possible. Docker Toolbox provides a way to use Docker on Windows systems that do not meet minimal system requirements for the Docker for Windows app.

But as of July 2018 it is just not true. After using Docker Toolbox for 3 months (and using native Windows Docker for a year) I can tell you for sure, Docker Toolbox is much more stable and flexible solution than Native Windows Docker. It just works!

There are few (easy to overcome) issues with Docker Toolbox I’ve encountered:

  1. It runs on virtual address (e.g. instead of localhost.
  2. No UI to increase VM memory for Docker.
  3. Symlinks doesn’t work when mapping back to NTFS host volume. Especially painful when using NodeJS’s node_modules bin symlinks.

Fortunately each of those issues is easily solvable.

Running on Localhost

Docker Toolbox uses VirtualBox and VirtualBox could map any ports of guest machines back to the host. So all we need to do is set this mapping up. There are 2 possible ways to do this: use console or VirtualBox GUI.

Let’s start with console way. Assuming your docker machine is called “default” and you want to map port 80 in your container to localhost:8888 you can run:

or if the VM is running:

Or just set it via GUI

Increasing VM Memory

By default Windows Docker dedicated 2Gb RAM, which is quite low. I’m using Elasticsearch in a few projects and it alone takes more than 1Gb of RAM.

And solutions is quite straightforward. It requires 2 steps. First: remove existing Docker virtual machine:

Second: re-create virtual machine with amount of RAM, CPU cores or disk space you want:

Restart Docker and the issue if solved.

Symlinks on host share

Symlinks issue was the most tricky for me, however workaround was quite easy. Windows 10 already supports symlinks, but somehow this functionality is enabled only for administrators. So all you need to do is launching “Docker quickstart terminal” as Administrator each time you work with Docker and that’s it — symlinks are created with no problem.

What about Native Windows Docker?

I believe Docker team is working hard on native solution for Windows, which is definitely more user-friendly. Probably It’ll become de-facto standard in future, but for now I recommend no one to use it: Docker Toolbox is much more stable and does not require Hyper-V with its clear downsides.

Short stories on software

Short stories about about making software

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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