Allow configurable behavior of TERM signal for runsvdir

From: Mitar <mmitar_at_gmail.com>
Date: Mon, 30 Jan 2017 09:52:03 -0800

Hi!

By default, Docker sends a TERM signal to a container when you want to
stop it. When runit is used as init inside a Docker container, this
directly kills the runsvdir process, without really cleaning up any
child processes.

In newer Docker version you can configure STOPSIGNAL inside your
Dockerfile to configure for example for Docker to send HUP to
runsvdir. But the issue is that because runsvdir exists immediately
after sending TERM to children, Docker kills the whole container
before really leaving to children to terminate gracefully.

So there would be two things to improve behavior inside Docker containers here:

First, there could be an option to set which signal is used as current
HUP signal. This could make it work in older Docker versions, as one
could for example run runsvdir --hup-signal=TERM to override behavior
of TERM signal.

Second, after it gets HUP signal, runsvdir could wait for all children
to finish before existing itself. (If they do not finish in reasonable
time, Docker will kill anyway all processes with KILL.)


Mitar

-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m
Received on Mon Jan 30 2017 - 17:52:03 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC