If you are developing containers you must have heard the “single process per
container” mantra. Inherently, there’s nothing wrong1 with running multiple
processes in a container, as long as your
ENTRYPOINT is a proper
init process. Some use cases are having processes are aiding each other
(such as a sidecar proxy process) or porting legacy applications.
Recently, I had to spawn a sidecar process inside a container. Docker’s own
for running multiple processes in a container is a good place to start, but not
production-ready. So I outsourced my quest on Twitter to find an
init replacement that can:
- run multiple child processes, but do not restart them
- exit as soon as a child process terminates (no point of restarting child processes, let the container crash to be restarted by docker or Kubernetes)
- fulfill PID 1 (
initprocess) responsibilities like zombie child reaping and signal forwarding.