Docker在内核级别的命名空间 [英] Docker Namespace in kernel level

查看:124
本文介绍了Docker在内核级别的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ p
$ b如何区分docker容器的pid 1,17等等与主机的1,17等pid的内容以及在Docker容器内创建新流程时发生的所有内核变化? $ b

在主机中可以看到Docker内的进程如何?

解决方案


如何区分docker容器的pid 1,17等与主机的1,17


默认情况下,这些pid在不同的命名空间中。 br>
由于问题10080 - pid主机,容器pids可以保留在主机的pid命名空间中。

还有 issue 10163:允许共享PID名称空间,请求一个 - pid = container:id


当我们在文档中创建一个新的进程时,所有内核发生了什么变化ker container


注意并更新2016年5月: issue 10163和 - pid = container:id 现在由 PR 22481 ,用于docker 1.12,允许加入另一个容器的PID命名空间。






内核级别没有更改,仅使用:




  • cgroups或控制组。孤立运行应用程序的一个关键是让他们只使用你想要的资源。

  • 联合文件系统为容器提供构建块


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?

解决方案

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在内核级别的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆