DockerInit » History » Revision 2
Revision 1 (cryptogopher, 2022-04-28 21:17) → Revision 2/10 (cryptogopher, 2022-04-28 21:36)
h1. Container @init@ process To enable running multiple processes, containers require process/service management. This is normally provided by some kind of @init@ task (e.g. provided by @sysvinit@). There are Docker-compatible replacements for full-fledged @init@s. Unfortunately they require either custom init scripts or service configurations. configuration. The process of migration from system provided OpenRC init scripts is time consuming and error prone. Usage of system's default @sysvinit@ is hampered by following shortcomings: * it mostly does not respond to Unix signals, which are used by Docker to manage containers (most importantly: signal termination), * it does not stop properly on container stop. Attempt to stop container with @init@ as PID 1 ends with error code 137: <pre> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b755c0f1b1d8 gentoo-base:20220415 "/sbin/init" About a minute ago Exited (137) 9 seconds ago gentoo-base </pre> @init@ process remains running afterwards: <pre> # docker-compose top gentoo-base UID PID PPID C STIME TTY TIME CMD ---------------------------------------------------------- root 3510 3489 0 17:40 ? 00:00:00 init [0] </pre> Nevertheless it is possible to use @sysvinit@ as a Docker container @init@ process. Required steps are following: