Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add respawn option #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add respawn option #146

wants to merge 1 commit into from

Conversation

zoxpx
Copy link

@zoxpx zoxpx commented Dec 23, 2019

  • add -R {A|F} option to emulate docker --restart always/on-failure behavior

REASON 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.

@yosifkit
Copy link

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.

@zoxpx
Copy link
Author

zoxpx commented Dec 24, 2019

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.

@amkartashov
Copy link

for those who interested in this functionality, check https://github.com/gorilych/restarter

* add `-R {A|F}` option to emulate `docker --restart always/on-failure` behavior
@Habbie
Copy link
Contributor

Habbie commented Jul 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants