它已经指出的是:
垫片允许无守护进程的容器。它基本上作为容器进程的父进程来促进一些事情。
它使 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) …Run Code Online (Sandbox Code Playgroud) 我正在关注文章中链接的以下 youtube 视频,该视频允许 docker 容器在主机上获得 root 访问权限。
有几个步骤不清楚,有人可以解释一下它们是如何进一步工作的吗?
https://www.lvh.io/posts/dont-expose-the-docker-socket-not-even-to-a-container.html
Step 1> Bind mount /var/run/docker.sock from host to container
Step 2> Install docker in container <<< at this stage I see that docker ps
-a shows all the containers which are present on the host.
**QUESTION:** How can the container see the containers present on the host? Is it because dockerd on the new container is using /var/run/docker.sock on the host? netstat/ss in the new container doesn't show anything..
Step 3> …Run Code Online (Sandbox Code Playgroud) 我有一个样本数据集:
1
2
3
4
5
6
Run Code Online (Sandbox Code Playgroud)
通过以下awk命令成功将其解析为所需的输出
awk 'ORS=NR%3?FS:RS'
1 2 3
4 5 6
Run Code Online (Sandbox Code Playgroud)
您能否提供此命令的解释?我无法将各个部分放在一起。
据我了解:
ORS =输出记录分隔符-这就是我们希望RS成为最终输出的原因,它是3列的行
NR%3 =我们要将数据分组为3个元素的行
?FS:RS -不确定如何适合命令。
谢谢。