If docker's host system is centos, why can I run ubuntu's image? After reading docker's introduction, my understanding is: the mirror system reuses the host system, ubuntu and centos are still quite different in many places. If the host system is centos6.0 and the mirror system is centos6.0, the feeling is very good. Ask the superior to answer! Thank you!
First of all, we need to distinguishLinux kernelAndLinux distribution
Linux kernelIt is the core of Linux operating system and is responsible for hardware management, such as memory management, disk management (file system), CPU management (process), etc …
Linux distributiononLinux kernelSome tool software, such as graphical interface, function library, software package management system and so on, have been added to the system. …
CentOS is different from Ubuntu.Linux distribution, they are all based onLinux kernel, just add different tool software. For example, their software package management system is different, CentOS uses yum command to install software, while Ubuntu uses apt-get command to install software.
Therefore CentOS and Ubuntu have the same kernel (version may be different), but different software is installed, i.e. different file systems.
Docker container technology is based onLinux kernelImplemented, it mainly uses two kernel modules:
Namespace: Used for isolation of containers, such as PID Namespace, which makes processes in containers unaware of the host and processes in other containers.
Cgroups: Resource control for the container, such as limiting the amount of memory or CPU used by the container.
When running a container based on Ubuntu image on CentOS, the container uses the kernel of CentOS host and Ubuntu image, in which Ubuntu software (apt-get) is installed.