Daud
Daud

Reputation: 7887

Why does this Docker FAQ say that containers don't contain OS inside it?

This FAQ from the official Docker page (cached here) says:

Unlike VMs, containers do not have an OS within it. They simply share the underlying kernel with the other containers.

OS is usually defined as kernel + shell. So, why is the above FAQ stating that OS is not there inside the container, when almost all images have a barebones OS present in them (except for the rarely used case when images are created from scratch)?

Images don't have the OS kernel inside them, but they do have an OS in all practical cases.

Upvotes: 0

Views: 139

Answers (1)

Antonio Petricca
Antonio Petricca

Reputation: 11050

The reason it is the power of docker!

Containers, expecially under linux, are based on the concept of namespaces. Namespaces allow to implement the concept of process isolation.

So, each container relies on the hosting OS by its own kernel, and offers services by different OS distribution packaged inside docker images.

The exception is, for example, a Windows container on Linux which requires a VM. Look at this post for further information.

Upvotes: 2

Related Questions