Docker Community Forums

Share and learn in the Docker community.

A couple of general questions regarding containers


(Thearctic) #1

I’m starting to learn about containers on both linux and windows but there are a couple of things that still bother me and I hope you guys could help me with them as I think they should be quite simple:

1- One of the main advantages of containers against VM’s is supposed to be the fact that for containers there´s no need for a Guest OS to run your application, but as far as I know, for windows containers you still need to run an OS (nano/ server core) to be able to use them. If this is the case, then what’s the real advantage of VMs vs containers on this matter?

2- Another basic premise for containers is that they should be very lightweight. In linux this can be easily achieved since the base os images are extremyly light (Alpine is 5MB,Ubuntu 180MB), but in windows the base image is almost 4GB!!. Would it be possible to run myapp without any base OS (using the host OS)?

Thanks!


(Michael Friis) #2

One of the main advantages of containers against VM’s is supposed to be the fact that for containers there´s no need for a Guest OS to run your application

Part of the advantage of containers is that only the operating system is virtualized, not the hardware. Multiple containers running on the same host share one operating system kernel. This makes for much better density and efficiency than VMs. This advantage applies equally to containers running on Windows and on Linux (at least as long as you don’t choose to run containers with Hyper-V, although even those are more efficient than full VMs).

Another basic premise for containers is that they should be very lightweight.

While it’s possible with Linux containers to create images FROM scratch, most images with apps that are not statically compiled are actually based on Linux distributions (like Ubuntu or Debian) with more complete userlands.

When creating Windows containers, you have the option of basing them on the more lightweight nanoserver image which is 358MB, as an alternative to the larger windowsservercore image.

Even using the larger windowsservercore image, building, moving around and running Windows containers is vastly more efficient than doing the same for VMs. Part of the reason for this is that Docker manages layers very efficiently: On any given system where you’re building or running Windows containers, the windowsservercore base layer is only fetched once. Any subsequent images built or pulled to that system simply re-uses that base layer (and any other layers that are shared between containers).


Windows Container and Docker already useful?