Sharing kernel of the host operating system while using Docker

和自甴很熟 提交于 2021-02-10 06:40:14

问题


  1. If I deploy an image built by choosing Alpine Linux as the base image on my Ubuntu machine (which acts as the host OS - where Docker is installed), will there be two kernels at play here - one from Ubuntu and another one from Alpine? I read that Docker containers will share the host Kernel, so I'm bit confused here.

  2. If I login to a running container and issue another command, will this be another process from the perspective of the host OS? Or will this be another thread? From the perspective of the guest OS, I think it will be two separate processes.

Kindly clarify.


回答1:


  1. A "container" is just an abstract term. It is just another process running on the Host (Ubuntu). Since your guest (Alpine) and Host (Ubuntu) both are Linux kernel based operating systems. Any command or program you run in the guest OS will be translated (by low level libraries) to system calls in the end and given to the kernel of the Ubuntu host.

  2. A "container" is nothing but a group of processes to which the host kernel applies some common policies. So any command or program you run in the guest OS (as you call it) let's say ping will create a process on host with the same policies applied by the kernel as you container.




回答2:


  1. They share your hosts kernel. Docker simply isolates group of processes into a container.

  2. There is no guest OS, only a container. And processes run in docker containers just like they would run on your host. If you run top (on the host), you will see all processes running in docker containers as child processes of any given container.



来源:https://stackoverflow.com/questions/55586621/sharing-kernel-of-the-host-operating-system-while-using-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!