Stay up-to-date with everything Linux!
Content directly fetched from the subreddit just for you.
Powered by : @r_channels
Post #42903
63

LI @r_linux
Showing posts older than #42904 · Back to latest








docker stop takes ten seconds on a container that is doing nothing at all, and it is not Docker being slow. It is documented kernel behaviour, in pidnamespaces(7), and it surprised me for longer than I would like to admit.sleep has no SIGTERM handler, so the signal goes nowhere, and the ten seconds are the runtime correctly waiting out a grace period for a shutdown that can never begin. Then SIGKILL, which is the one signal that gets through regardless.SigCgt in /proc/PID/status is a hex bitmask of the signals that process has installed handlers for:0x4000. All zeroes means nothing is caught, which means SIGTERM will be discarded, which means you are going to wait the full grace period.--init puts a tiny init as PID 1 which does have handlers and forwards them, which fixes it for anything. A trap in your entrypoint fixes it for your own script. Changing --stop-signal only helps if the process actually handles the signal you switch to.exec behaves differently from one that does. Without exec your shell is PID 1, and shells do not install a default SIGTERM handler for non-interactive use either.