Docs/CloudNative/Docker/dumb-init.md
2022-10-18 16:59:37 +08:00

6 lines
No EOL
604 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

容器化环境中往往直接运行应用程序而缺少初始化系统如systemd、sysvinit等。这可能需要应用程序来处理系统信号接管子进程进而导致容器无法停止、产生僵尸进程等问题。dumb-init旨在模拟初始化系统功能避免上述问题的发生。
```
### 举例
docker run quay.io/gravitational/debian-tall /usr/bin/dumb-init /bin/sh -c "sleep 10000"
```
除了在容器中使用之外dumb-init也可以直接在shell脚本中使用。使用dumb-init作为shell的父进程可以解决shell创建的子进程优雅退出问题