54

I'm installing Docker for Windows (CE) on Windows 10 and the first screen asks me:

[  ] Use Windows containers instead of Linux containers (this can be changed after installation)

This seems an important decision, yet the Docker documentation, FAQ and Windows container tutorial provides no information about why I might choose one over the other.

It would be helpful to have an objective overview of the ramifications of this choice:

  • Will one option be faster than the other?
  • Does the decision affect usage of system resources (RAM, CPU)?
  • Can I run the same images on both types?
  • Is one more secure than the other?

Any other distinctions that might help me reach a conclusion would be very welcome.

Duncan Jones
  • 680
  • 1
  • 6
  • 17
  • The answer to this is not opinion based. And it is accepted. So no need to close this one. – Nils Dec 21 '18 at 09:45
  • I think that a better answer to what the OP really wanted to know (although possibly didn't ask it so precisely) is here: https://stackoverflow.com/a/48080376/261332, or here: https://stackoverflow.com/a/48080526/261332 (they are both in the same question) – userfuser Feb 08 '20 at 07:05

1 Answers1

27

You HAVE to use a windows host for windows containers, however you can use either a Linux host or a Windows host for Linux containers. Since April 2018 you can even run both in parallel.

Will one option be faster than the other?

No. faster at what?

Does the decision affect usage of system resources (RAM, CPU)?

Windows uses more resources than Linux - Windows Nano is as small as it gets

Can I run the same images on both types?

No. you can run .NET apps in mono containers but you cannot start a windows container on a Linux host and vice versa - it's not the same as virtualization

Is one more secure than the other?

Again - more secure at what? No. They both run native Docker so it's nothing like hyper-v vs VMware and more like Linux vs Windows so it all depends on what you are going to run .net, python, java, ruby etc.

Jonas Heidelberg
  • 1,184
  • 1
  • 7
  • 14
Sum1sAdmin
  • 1,914
  • 1
  • 11
  • 20
  • 3
    Second this. The read complement this answer https://containerjournal.com/2016/10/28/linux-vs-windows-containers-whats-difference/ – A.Newgate Apr 17 '18 at 11:50
  • 4
    So if I select to use Linux containers, Docker will fire up a Hyper-V Linux VM to run my containers, otherwise it will run Windows containers natively? And I can't run both types of container concurrently? – Duncan Jones Apr 17 '18 at 12:12
  • 1
    docker for windows 10 allows you to do this - but in production you would have a docker swarm with Linux and Windows hosts – Sum1sAdmin Apr 17 '18 at 12:14
  • Docker is based on lxc (Linux) - it will use the same kernel as the Docker-host. If you start windows in a lxc it has to virtualize or emulate win. Not sure if the same applies to win-docker, since win supports linux. – Nils Dec 21 '18 at 09:48
  • 2
    @DuncanJones, just 3 days after you asked there was a [blog post](https://blogs.msdn.microsoft.com/premier_developer/2018/04/20/running-docker-windows-and-linux-containers-simultaneously/) on MSDN explaining that you now CAN run Windows and Linux containers in parallel. – Jonas Heidelberg Jan 23 '19 at 21:00
  • This answer doesn't clear much up for me. Do Windows containers also run in separate Hyper-V VMs? Is it as simple as "windows images require windows containers, linux images require linux containers"? – OrangeDog Jun 27 '19 at 13:11
  • yes they 'also' run in lightweight hyper-v vms. but, their natural design is a chroot environment which is isolated or 'contained' but using the same kernel, e.g. not running in it's own OS with hardware emulation, i.e. virtualization. Microsoft now offer 'process isolated' containers which share the same kernel as the host and do not require a separate virtual machine - as to the requirements - it's kernel fork and chroot'ed environment essentially, so the requirements of the host are a running Windows/Linux kernel, you can't fork a Linux kernel and run Windows and vice versa :-) – Sum1sAdmin Jun 28 '19 at 08:54
  • 1
    @Sum1sAdmin put that in the answer – OrangeDog Jul 17 '19 at 11:15
  • @OrangeDog - That wasn't the question – Sum1sAdmin Jul 19 '19 at 09:28