On 02/02/2017 03:29 PM, Mitar wrote:
Hi!

Hm, when I read the runit man page I got scared because of its trying
to reboot and halt the machine. I am not sure how will that interact
with a Docker container. I also didn't want one extra process to be in
every container. But you are right, it seems it might be necessary
anyway.

So, let 'see. I could simply then use runit as PID 1 inside a Docker
image. /etc/runit/1 could be an empty script (is it even required to
have it, if not needed?). /etc/runit/2 would then start runsvdir.
Should it exec into it?

I would then map Docker stop signal to be SIGINT, and I would create a
/etc/runit/ctrlaltdel script which would gracefully call stop on all
services. Or does runit already do that?

If /etc/runit/stopit does not exit, then sending the SIGINT signal to
runit does not do anything besides running the /etc/runit/ctrlaltdel
script?


Mitar

I'm going to really recommend checking out the s6-overlay, I think it
will do everything you're talking about out-of-the-box. No need to
customize the Docker stop signal, it handles gracefully shutting
down services, reaping orphaned processes, and so on. It's really
useful and will probably save you a lot of time.

https://github.com/just-containers/s6-overlay

-John Regan

Reply via email to