docker container does not need an OS, but each container has one. Why? : <p>"docker" is a buzz word these days and I'm trying to figure out, what it is and how does it work. And more specifically, how is it different from the normal VM (e.g. VirtualBox, HyperV or WMWare solutions).</p>

<p>The introduction section of the documentation (<a href="https://docs.docker.com/get-started/#a-brief-explanation-of-containers" rel="noreferrer">https://docs.docker.com/get-started/#a-brief-explanation-of-containers</a>) reads:</p>

<blockquote>
  <p>Containers run apps natively on the host machine’s kernel. They have better performance characteristics than virtual machines that only get virtual access to host resources through a hypervisor. Containers can get native access, each one running in a discrete process, taking no more memory than any other executable.</p>
</blockquote>

<p>Bingo! Here is the difference. Containers run directly on the kernel of hosting OS, this is why they are so lightweight and fast (plus they provide isolation of processes and nice distribution mechanism in the shape of docker hub, which plays well with the ability to connect containers with each other).</p>

<p>But wait a second. I can run Linux applications on windows using docker - how can it be? Sure, there is some VM. Otherwise we would just not get job done...</p>

<p>OK, but how does it look like, when we work on Linux host??? And here comes real confusion... there one still defines OS as a base image for every image we want to create. Even if we say "FROM scratch" - scratch is still some minimalistic kernel... So here comes</p>

<p><strong>QUESTION 1</strong>: If I run e.g. CentOS host, can I create the container, which would directly use kernel of this host operating system (and not VM, which includes its own OS)? If yes, how can I do it? If no, why the documentaion of docker lies to us (as then docker images always run within some VM and it is not too much different from other VMs, or ist it?)?</p>

<p>After some thinking about it and looking around I was wondering, if some optimization is done for running the images. Here comes</p>

<p><strong>QUESTION 2</strong>: If I run two containers, images of both of which are based on the same parent image, will this parent image be loaded into memory only once? Will there be one VM for each container or just one, which runs both containers? And what if we use different OSs?</p>

<p>The third question is quite beaten:</p>

<p><strong>QUESTION 3</strong>: Are there somewhere some resources, which describe this kind of things... because most of the articles, which discuss docker just tell "it is so cool, you must definitely use ut. Just run one command and be happy"... which does not explain too much.</p>

<p>Thanks.</p>
