Open zoxpx opened 4 years ago
As just an interested party, I would vote against this addition. tini
's strength is its limited scope and this seems outside that. Restarting stopped containers should be done by whatever is orchestrating them.
All Tini does is spawn a single child (Tini is meant to be run in a container), and wait for it to exit all the while reaping zombies and performing signal forwarding.
This PR implements the respawn in a minimalistic way, and it is a great solution for container-applications that need to be able to restart internally, without also stopping the container. Note that systemd(1) also supports restarts/respawns, as well as many container-runtimes, but sadly restarts/respawns are not included in the runc spec and container-runtimes are not required to implement it.
for those who interested in this functionality, check https://github.com/gorilych/restarter
With this PR, a SIGTERM
send to tini
is forwarded to the child process, which terminates, and then gets restarted. I feel SIGTERM to tini
should disable respawns, and thus exit tini
when the child process exits after that SIGTERM
.
-R {A|F}
option to emulatedocker --restart always/on-failure
behaviorREASON FOR CHANGE: The tini-based container could be run via non-docker container runtime (e.g. containerd, cri-o or raw runC), which may not support the "xxx --restart always/on-failure" behavior. This change adds the restarts capability straight into the
tini
code.