Docker Community Forums

Share and learn in the Docker community.

Hyper-V or Native Windows Containers?


(Pspattillo) #1

In a nutshell, I’m seeking direction and a way out of the fog of so many seemingly contradictory blogs regarding containers and VMs. No doubt I’ve missed some things that might be on this site but I have plowed through a lot of the Docker docs and am managing some containers now. Many Docker blogs are adamant about the advantages of containers not being VMs yet Docker for Windows relies on Hyper-V which according to this blog comes at a 9-12% (documented here: https://www.stratoscale.com/blog/containers/running-containers-on-bare-metal/ ) hit despite all the kudo to it regarding how lightweight it is. Questions are embedded inline but in bold.

I did find one great blog in the area referring to Native Windows Containers and the available windows approaches for hosting containers here: https://sreeninet.wordpress.com/2017/05/13/docker-for-windows-different-modes/

I’ve been confused by many blogs about containers not being VMs despite Docker for Windows using Hyper-V and forgoing the highly vaunted kernel sharing advantages. Performance and resource consumption should be considerations. I was at a crossroads, trying to decide whether to use Windows Hyper-V -based container or containers for SQL Server and ASP-dot-Net Core for Linux

Is it fair to say that Native windows containers for W2K16 will perform better than those based on Hyper-V? Nothing I read seems able to admit this yet it seems to be the direction. If these are improvements then prior approaches have shortcomings that can’t be wished away.

I have Hyper-V installed on my Windows 10 pro machine and am running a Docker for Windows CE Edge version 17.03.1-ce-rc1-win3 (10625). I use the taskbar Docker switch function to switch between Linux and Windows container development but can only see a MobyLinux Hyper-VM in the Hyper-V Manager application. When I switch to Windows container development and run the hello-world app from a window container I see no Hyper-V VM for any windows OS in the Hyper-V Manager app.

So, am I to assume that the Container being used in this case is a native windows container? I’ve been very puzzle by all the contradictory information I see regarding native vs. VM-based containers.

Can anyone comment, or better still, point me at other sources of information that can clear up such confusion? I’m not sure how to plow through all the release notes to understand whether a given release supports the Windows Native Containers referred to in second link above. Surely there must be some solid information on this topic somewhere. It would be a large waste of time to go down the wrong path then reverse course. I’m not averse to running Linux containers but I’d rather take the approach that provides the best performance.

Also, does anyone know whether ASP-dot-.Net Core builds can be provisioned for Linux containers? I suspect the answer is yes. That’s what I plan to focus on next after settling on the best alternative for Docker containers. I do also have W2K16 running in Hyper-V so if there are any W2K16 advantages (such as Windows Native Containers) only possible on W2K16 that is possible too. Would running Docker in W2K16 under Hyper-V be viable? Is that commonly done?

Many thanks for some feedback and guidance. I’m not looking for detail, just high level direction.


(Sam) #2

the problem on windows is the runtime doesn’t look or act like linux. there have been attempts, but they have been unsuccessful… (same problem on mac)

so, the only reliable way so far is to create that linux environment, and do some fancy footwork to make it LOOK local as much as they can. so, they need to create a virtual machine… on windows you do that with Hyper-V.
unless u are running one of the virtual machine engines… (two conflicting technologies)…

supposedly newer versions of windows are adding support to enable direct containers… but I haven’t seen anything yet…


(Pspattillo) #3

Does that mean the references to native Windows containers in the article (say only on W2K16 ATM) is incorrect? Might it be viable to run Hyper-V VM hosting Docker EE Basic running native Windows containers? I am creating a labs/dev environment. My sense is that it being closer to production might avoid inevitable Docker version differences but even if it won’t I am curious as to whether this might be a viable option. Thanks for commenting.


(Sam) #4

see this blog post… https://blog.docker.com/2016/09/dockerforws2016/


(Michael Friis) #5

Is it fair to say that Native windows containers for W2K16 will perform better than those based on Hyper-V?

Please see this presentation: https://channel9.msdn.com/Events/Ignite/2016/BRK3146

So, am I to assume that the Container being used in this case is a native windows container?

No, on Windows 10 only Hyper-V isolation is available. The Windows 10 kernel configuration is a little different from the Windows Server kernel configuration, so Hyper-V isolation is required.

Can anyone comment, or better still, point me at other sources of information that can clear up such confusion?

See above.

Also, does anyone know whether ASP-dot-.Net Core builds can be provisioned for Linux containers?

Yes

Would running Docker in W2K16 under Hyper-V be viable? Is that commonly done?

Yes, process (non-Hyper-V) isolated containers work great this way, and you can also use Hyper-V isolation if you enable nesting: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization


(Pspattillo) #7

Thanks Michael,

My Windows 10 Pro has Anniversary Edition installed. So I am wondering whether this explains the absence of any Windows OS Hyper-V VM being shown in Hyper-V Manager (as there is for MobyLinux) after running the Hello-World app when in Windows container development mode (as set in DOcker taskbar applet). I do not believe there is a way for a Hyper-V VM to be created and run without it appearing in Hyper-V manager but I could be mistaken about that.

I read that Windows might let Nano atrophy and die because the footprint and resource requirements are not much less than Windows Server container…or so it was posited in a blog I read.


(Michael Friis) #8

this explains the absence of any Windows OS Hyper-V VM being shown in Hyper-V Manager

It does not. While Docker running on Windows uses Hyper-V technology to run Docker containers, running Hyper-V isolated Docker Windows containers doesn’t create actual Hyper-V VMs that you can futz around with in Hyper-V manager. There are more details in the announcement blog post:

while Hyper-V is the runtime technology powering hyper-v isolation, hyper-v isolated containers are not Hyper-V VMs and cannot be managed with classic Hyper-V tools.

Windows might let Nano atrophy and die because the footprint and resource requirements are not much less than Windows Server container

I think that’s a misunderstanding. I’m also curious to understand why you think that concern is pertinent to the topic at hand? As you can see from the slides I posted, Nanoserver uses less resources than Windowsservercore. Details on future plans here: https://docs.microsoft.com/en-us/windows-server/get-started/nano-in-semi-annual-channel


(Pspattillo) #9

Not trying to be obtuse…I was wondering about Nano because of some (possibly misguided) articles I read. It’s just another choice to make regarding the lab environment I’m setting up. I hear you about the distinction between Hyper-V technology and Hyper-V VM. Apparently Hyper-V isolation does not require a typical VM. Thanks for the links.