search

Home  >  Q&A  >  body text

coreos - docker的宿主系统是centos,为什么可以运行ubuntu的镜像呢?

请问:

如果docker的宿主系统是centos,为什么可以运行ubuntu的镜像呢?
看了docker的介绍后,俺的理解是:镜像系统复用了宿主系统, ubuntu和centos在很多地方还是有很大区别的,

如果宿主系统是centos6.0,镜像系统也是centos6.0, 感觉就很好理解了。

求高人解答!感谢!
怪我咯怪我咯2775 days ago609

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-24 09:15:25

    First you need to distinguish between Linux kernel and Linux distribution

    • Linux kernel is the core of the Linux operating system and is responsible for hardware management, such as managing memory, managing disk (file system), managing CPU (process), etc...

    • Linux distribution is based on the Linux kernel and adds some tool software, such as graphical interface, function library, software package management system, etc...

    CentOS and Ubuntu are different Linux distributions. They are both based on the Linux kernel, but the added tools and software are different. For example, their software package management systems are different. CentOS uses the yum command to install software, while Ubuntu uses the apt-get command to install software.

    So the kernels of CentOS and Ubuntu are the same (the versions may be different), but the installed software is different, that is, the file systems are different.

    Docker container technology is implemented based on the Linux kernel. It mainly uses two kernel modules:

    • Namespace: Used for container isolation. For example, PID Namespace makes the process in the container unable to sense the host and processes in other containers.

    • Cgroups: Used for container resource control, such as limiting the memory size or number of CPUs used by the container.

    When running a container based on the Ubuntu image on CentOS, the container uses the kernel of the CentOS host and the Ubuntu image. Various Ubuntu software (apt-get) is installed in the Ubuntu image.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-24 09:15:25

    Reuse some things of the Linux kernel, while centos and ubuntu are developed based on the Linux kernel

    reply
    0
  • Cancelreply