Trisha McCanna

Considerations for Running Docker for Windows Server 2016 with Hyper-V VMs

We often get asked at Docker, “Where should I run my application? On bare metal, virtual or cloud?” The beauty of Docker is that you can run a container anywhere, so we usually answer this question with “It depends.” Not what you were looking for, right?

To answer this, you first need to consider which infrastructure makes the most sense for your application architecture and business goals. We get this question so often that our technical evangelist, Mike Coleman has written a few blogs to provide some guidance:

During our recent webinar, titled “Docker for Windows Server 2016”, this question came up a lot, specifically what to consider when deploying a Windows Server 2016 application in a Hyper-V VM with Docker and how it works. First, you’ll need to understand the differences between Windows Server containers, Hyper-V containers, and Hyper-V VMs before considering how they work together.

A Hyper-V container is a Windows Server container running inside a stripped down Hyper-V VM that is only instantiated for containers.

This provides additional kernel isolation and separation from the host OS that is used by the containerized application. Hyper-V containers automatically create a Hyper-V VM using the application’s base image and the Hyper-V VM includes the required application binaries, libraries inside that Windows container. For more information on Windows Containers read our blog. Whether your application runs as a Windows Server container or as a Hyper-V container is a runtime decision. Additional isolation is a good option for multi tenant environments. No changes are required to the Dockerfile or image, the same image can be run in either mode.

Here we the the top Hyper-V container questions with answers:

Q: I thought that containers do not need a hypervisor?

A: Correct, but since a Hyper-V container packages the same container image with its own dedicated kernel it ensures tighter isolation in multi-tenant environments which may be a business or application requirement for specific Windows Server 2016 applications.

Q: ­Do you need a hypervisor layer before the OS in both Hyper-V and Docker for Windows Server containers?

A: The hypervisor is optional. With Windows Server containers, isolation is achieved not with hypervisor, but with process isolation, filesystem and registry sandboxing.

Q: Can the Hyper-V containers be managed from the Hyper-V Manager, in the same way that the VM’s are? (ie. turned on/off, check memory usage, etc?)

A: While Hyper-V is the runtime technology powering Hyper-V Isolation, Hyper-V containers are not VMs and neither appear as a Hyper-V resource nor be managed with classic Hyper-V tools, like Hyper-V Manager. Hyper-V containers are only executed at runtime by the Docker Engine.

Q: Can you run Windows Server container and Hyper-V VMs running Linux workloads on the same host?

A: Yes. You can run a Hyper-V VM with a Linux OS on a physical host running Windows Server.  Inside the VM, you can run containers built with Linux.

Next week we’ll bring you the next blog in our Windows Server 2016 Q&A Series – Top questions about Docker for SQL Server Express. See you again next week.

For more resources:

, , ,

Trisha McCanna

Considerations for Running Docker for Windows Server 2016 with Hyper-V VMs


2 Responses to “Considerations for Running Docker for Windows Server 2016 with Hyper-V VMs”

  1. Ruud Borst

    Hi Trisha, nice blog and it gives a little more away about Hyper-V containers. What I miss is documentation about the Hyper-V Container Template instance. See my question in the TechNet forum here : https://social.technet.microsoft.com/Forums/office/en-US/4707444f-cea7-49b9-80be-f33e8301901e/hyperv-container-template?forum=windowscontainers I managed to performance monitor Hyper-V containers with my Tool and stumbled upon the Container Template which runs the moment you create a 'Hyper-V' container. Regards, Ruud

    Reply
  2. Nore Gabbidon

    Hi. Unfortunately, you cannot run docker on a windows 10 vm (the one caveat there being that I think VMWare may allow it). There are all sorts of problems and its not worth it. However, seeing as docker is now included more like a service in Server 2016, would it be possible to do this for Server 2016 if it were running as a VM?

    Reply

Leave a Reply to Ruud Borst

Click here to cancel reply.

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.