Docker – What are the advantages of using a process manager inside a Docker container


As mentioned by Jerome,

You also need to add a process manager; for instance Monit or Supervisor. This is because Docker will watch one single process. If you need multiple processes, you need to add one at the top-level to take care of the others. In other words, you're turning a lean and simple container into something much more complicated.

It's not completely clear to me why you would need a process manager inside of a container.

So can someone explain to me, what are all the advantages of having a process manager inside a container? Wouldn't it be better to let systemd or upstart handle the processes, instead of adding extra services to your container?

Best Answer

That's the whole idea, to use systemd (or upstart etc) inside a container. Docker is used most of the time to run a single service per container, so for a complex site you would need a container for the web server and another one for the database server. With a process manager you could run both in the same container.

Which approach is better is opinion-based. Though from what I've seen running systemd inside Docker isn't easy as of June 2014, for example there's bug #3629 - "running systemd inside docker arch container hangs or segfaults". For more details also read "Running systemd within a Docker Container".