Why CTRL+C doesn't stop the container (and how to fix it with docker --init)


Many times while working with containers with Docker, although there are now alternatives such as Podman, the signals that cause the container to stop—like CTRL+C (SIGINT)—didn't reach the container and, in many cases, I had to force its exit.

While reading about containers, I found that Docker has long included the option --init in the run command to improve handling of system signals. It does this by launching a small program, tini, which takes PID 1 and handles both the system signals and zombie processes.

It reminded me of the time when I studied operating systems more deeply.