Alternative to supervisord for docker

4ybaka picture 4ybaka · Nov 22, 2015 · Viewed 10.6k times · Source

Supervisord is really great tool even for docker environment. It helps a lot with stderr redirection and signals forwarding. But it has a couple of disadvantages:

  1. It doesn't support delayed startup. It could be useful to delay some agent startup until main app is initializing. Priority doesn't solve this issue.
  2. If some app enters FATAL state supervisord just logs it but continue to work. So you can't see it until look at logs of container. It could much more friendly if supervisord just stops because in that case you see the problem with docker ps -a

So what is the best alternative to supervisord?

Answer

VonC picture VonC · Nov 22, 2015

In response to the "PID1 zombie reaping" issue, I recommended before (in "Use of Supervisor in docker") to use runit instead of supervisord

Runit uses less memory than Supervisord because Runit is written in C and Supervisord in Python.
And in some use cases, process restarts in the container are preferable over whole-container restarts.

See the phusion/baseimage-docker image for more.


As noted by Torsten Bronger in the comments:

Runit is not there to solve the reaping problem.
Rather, it's to support multiple processes. Multiple processes are encouraged for security (through process and user isolation).

Since 2015, you now can Specify an init process that should be used as the PID 1 in the container, with docker run --init

The default init process used is the first docker-init executable found in the system path of the Docker daemon process.
This docker-init binary, included in the default installation, is backed by tini.