容器化:Containerd组件之containerd-shim-runc-v2
·
一 Containerd 如何启动container

- 当客户端通过调用 containerd 来创建一个容器时,当containerd 收到请求后,并不会直接去创建容器,而是创建 containerd-shim 进程,通过进程去操作容器;
- containerd-shim 启动后会去启动 /usr/bin/containerd-shim-runc-v2 的进程,然后立即退出,此时 containerd-shim-runc-v2 的父进程就变成了systemd(1),这样 containerd-shim-runc-v2 就和containerd脱离了关系,containerd退出也不会影响到容器(这也是containerd-shim套件的作用);
- /usr/bin/containerd-shim-runc-v2 会运行runc这个二进制文件去create、start容器,runc 启动完容器后本身会直接退出, containerd-shim-runc-v2 会成为容器进程的父进程, 负责收集容器进程的状态, 上报给 containerd, 并在容器中 pid 为 1 的进程退出后接管容器中的进程(containerd-shim-runc-v2进程所有子孙进程)进行清理, 确保不会出现僵尸进程。
更多推荐
所有评论(0)