Understanding Docker "Container Host" vs. "Container OS" for Linux and Windows Containers
Lets explore the relationship between the “Container Host” and the “Container OS” and how they differ between Linux and Windows containers.
Some Definitions:
- Container Host: Also called the Host OS. The Host OS is the operating system on which the Docker client and Docker daemon run. In the case of Linux and non-Hyper-V containers, the Host OS shares its kernel with running Docker containers. For Hyper-V each container has its own Hyper-V kernel.
- Container OS: Also called the Base OS. The base OS refers to an image that contains an operating system such as Ubuntu, CentOS, or windowsservercore. Typically, you would build your own image on top of a Base OS image so that you can take utilize parts of the OS. Note that windows containers require a Base OS, while Linux containers do not.
- Operating System Kernel: The Kernel manages lower level functions such as memory management, file system, network and process scheduling.
Now for some pictures:
In the above example
- The Host OS is Ubuntu.
- The Docker Client and the Docker Daemon (together called the Docker Engine) are running on the Host OS.
- Each container shares the Host OS kernel.
- CentOS and BusyBox are Linux Base OS images.
- The “No OS” container demonstrates that you do not NEED a base OS to run a container in Linux. You can create a Docker file that has a base image of scratch and then runs a binary that uses the kernel directly.
- Check out this article for a comparison of Base OS sizes.
In the above example
- The Host OS is Windows 10 or Windows Server.
- Each container shares the Host OS kernel.
- All windows containers require a Base OS of either nanoserver or windowsservercore.
In the above example
- The Host OS is Windows 10 or Windows Server.
- Each container is hosted in its own light weight Hyper-V VM.
- Each container uses the kernel inside the Hyper-V VM which provides an extra layer of separation between containers.
- All windows containers require a Base OS of either nanoserver or windowsservercore.
A couple of good links: