My Adventures with Docker for Windows

I am a huge fan of Docker.  Being able to replicate the exact environment in both development and production is very valuable.  So I was quite excited when I learned Windows 10 has Docker for Windows.

Windows 10

Docker for Windows has better support than Docker toolbox.  The main feature, in my opinion, is the ability to run Windows containers.  Now you can replicate an environment for Windows.

As with all new technologies, they take time to mature.  That was my conclusion after testing Docker for Windows.  There were too many “gotcha’s” that made me unwilling to accept it.

  • You cannot use VirtualBox with it
  • Hyper-V is harder to setup and doesn’t support Linux as well as VirtualBox
  • Windows containers are slow

No VirtualBox

In order to use Docker for Windows, you have to use Windows 10’s Hyper-V hypervisor.  A hypervisor is the software that emulates guest OS.  Popular ones are VirtualBox and VMWare.

Once I enabled Hyper-V, containers, and some other Windows 10 features, I attempted to start VirtualBox with my Ubuntu VM.  And I got a pleasant surprise: I can’t!

Denied

Hyper-V and VirtualBox do not work together.  So in order to use Docker for Windows, I must swap all of my VirtualBox VMs to Hyper-V.

This is a big show-stopper for me.  While I may be able to switch myself, I can’t force everybody in my company to also make the switch!

In addition, I found Hyper-V to not have all the features I would want from it.

Linux Support and General Settings in Hyper-V

Hyper-V works relatively well with the Ubuntu VM I tried it with.  However, there were several drawbacks that were annoying enough to make me ditch it.

Tux

I had problems with the display.  In VirtualBox, I can change the display size of the VBox Window and the OS automatically resizes for that window size.

This does not seem like such a big deal until Hyper-V doesn’t do it.  In addition, it did not support multiple monitors when I last tested it (about Summer or Fall 2017 timeframe).  Perhaps there is a hacky way to do it, but I could never figure it out.

In addition, copy-paste functionality did not work for me (from Windows 10 host to Ubuntu 16.04 emulated OS in Hyper-V).  Again, there may have been some special setting to turn on, but I could never find it.  I did spend around 1-2 hours trying to figure it out before giving up.

It’s amazing what small things you really start to appreciate when they are taken away!

Windows Containers Are Slow

This one was pretty disappointing.  Don’t get me wrong; being able to launch Windows containers is awesome.

However, my experience was 30-60 second wait times for even small Windows containers (like the nanoserver image).  Contrast that to my usual wait-time for containers to start: < 2 seconds.

Sloth

That’s right – I can start about 15 Linux containers before my first Windows container will come up.

While 30-60 seconds is still faster than a VM, it’s not all that much faster.  Nothing like my experience with Linux containers.

Conclusion

I think Docker for Windows is still a new technology.  So a lot of the nitpicky stuff is not yet ironed out.

Part of being on the cutting edge of new technology means sometimes things aren’t going to work out for your use case.  That’s part of being a trailblazer – sometimes you have to deal with issues that slow-adopters don’t have to worry about.

I can see container load times getting faster.  I can also see the Linux issues I pointed out to get fixed.

I don’t necessarily see the VirtualBox vs. Hyper-V compatibility to change.  I want to say I read that there are some fundamental reasons why they can’t coexist.

The very fact that we still use Windows 7 at work for some things prevents me from using Windows 10, and therefore Docker for Windows.  (Yes I know I can upgrade them, but there are reasons that we are not doing that.)  Unfortunately, Docker Toolbox is not as nice as Docker for Windows and has its own set of ‘issues’.

My best suggestion?  Just use Linux as your host OS if at all possible.  Docker is best supported on there.  You won’t run into weird problems like sharing files and accessing networks in a VM (more on this in the future).

If you must use Windows, use Docker for Windows if you don’t need VirtualBox and can live with some Linux emulation quirks.

Otherwise, you will need to use Docker toolbox and live with its own set of quirks.

Happy containerizing!

One comment:

Leave a Reply

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