它已经指出的是:
垫片允许无守护进程的容器。它基本上作为容器进程的父进程来促进一些事情。
它使 STDIO 和其他 fds 为容器打开,以防 containerd 和/或 docker 都死了。如果 shim 没有运行,则管道的父端或 TTY 主机将关闭,容器将退出。
然而,从进程级别来看,containerd 似乎会产生 containerd-shim,所以如果 containerd 关闭,我希望 containerd-shim 也会关闭。
有人能解释一下如果 containerd/docker 停机,containerd-shim 是如何保持运行的吗?
$ ps fxa | grep dockerd -A 3
PID TTY STAT TIME COMMAND
43449 pts/2 S+ 0:00 \_ grep dockerd -A 3
117536 ? Ssl 163:36 /usr/bin/containerd
93633 ? Sl 1:01 \_ containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/8f75a1b32bb09611430ea55958b11a482b6c83ba2a75f7ca727301eb49a2770f -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
$ pstree -lpTs
systemd(1)???VGAuthService(45146)
??accounts-daemon(1053)
??agetty(104696)
??agetty(104707)
??agetty(104716)
??atd(993)
??containerd(117536)???containerd-shim(8394)???bash(8969)
? ? ??sh(8420)???sshd(8512)
? ? ??tail(8514)
? ??containerd-shim(13170)???bash(13198)
? ??containerd-shim(13545)???portainer(13577)
? ??containerd-shim(14156)???mysqld(14184)
...
??dockerd(42320)???docker-proxy(42700)
? ??docker-proxy(42713)
? ??docker-proxy(42725)
? ??docker-proxy(42736)
? ??docker-proxy(42749)
Run Code Online (Sandbox Code Playgroud)
更新:根据接受的答案中提供的解释:
$ pstree -lpTs
systemd(1)???VGAuthService(45146)
??accounts-daemon(1053)
??agetty(104696)
??agetty(104707)
??agetty(104716)
??atd(993)
??containerd(117536)???containerd-shim(8394)???bash(8969)
? ? ??sh(8420)???sshd(8512)
? ? ??tail(8514)
? ??containerd-shim(13170)???bash(13198)
? ??containerd-shim(13545)???portainer(13577)
? ??containerd-shim(14156)???mysqld(14184)
$ sudo kill -9 117536
$ pstree -lpTs
systemd(1)???VGAuthService(45146)
??accounts-daemon(1053)
??agetty(104696)
??agetty(104707)
??agetty(104716)
??atd(993)
??containerd-shim(8394)???bash(8969)
? ??sh(8420)???sshd(8512)
? ??tail(8514)
??containerd-shim(13170)???bash(13198)
??containerd-shim(13545)???portainer(13577)
??containerd-shim(14156)???mysqld(14184)
Run Code Online (Sandbox Code Playgroud)
然而,从进程级别来看,containerd 似乎会产生 containerd-shim,所以如果 containerd 关闭,我希望 containerd-shim 也会关闭。
子进程在其父进程死亡时不会自动终止,它们只是简单地重新父进程为 PID 1。systemd作为父进程接管并containerd-shim继续运行。
| 归档时间: |
|
| 查看次数: |
2112 次 |
| 最近记录: |