Docker Namespace in kernel level

2020-03-07 06:56发布

问题:

How to differentiate pid 1,17 etc of docker containers with host's 1,17 etc pid's and what all the kernel changes are happening when we create a new process inside the docker container?

How the process inside the docker can be seen in the host?

回答1:

How to differentiate pid 1,17 etc of docker containers with host's 1,17

By default, those pid are in different namespace.
Since issue 10080 and --pid host, the container pids can stay in the host's pid namespace.
There also issue 10163: "Allow shared PID namespaces", requesting a --pid=container:id

what all the kernel changes are happening when we create a new process inside the docker container

Note and update May 2016: issue 10163 and --pid=container:id is now resolved by PR 22481 for docker 1.12, allowing to join another container's PID namespace.


No changes on the kernel level, only the use of:

  • cgroups or control groups. A key to running applications in isolation is to have them only use the resources you want.
  • union file systems to provide the building blocks for containers


标签: docker