How docker supports multiple Linux distros on top of the existing host os kernel?

As far I have understood, Docker uses the host os Linux kernel for the kernel space and guest os like Alpine Linux in the user space. So, does it implies that it possible to run multiple Linux distros sharing a single kernel?

eg: As I am running Ubuntu 20.04.2 LTS can I download the application and binary data of CentOS and run it on top of my existing kernel inside cgroup?

How does docker make it happen?


Because almost all distros (ubuntu/debian/centos…) uses the same kernel, but uses it in different ways. So when you start a centos container on a ubuntu, it will work, but the folder structure might be different, the package manager is different, but how it execute binaries and so on, is the same across all distros.

So yes, on your ubuntu, you can run centos applications, in a container

1 Like