Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How critical is dumb-init for Docker?

Tags:

docker

init

I hope that this question will not be marked as primarily opinion-based, but that there is an objective answer to it.

I have read Introducing dumb-init, an init system for Docker containers, which extensively describes why and how to use dumb-init. To be honest, for someone not too experienced with how the Linux process structure works, this sounds pretty dramatic - and it feels as if you are doing things entirely wrong if you don't use dumb-init.

This is why I'm thinking about using it within my very own Docker images… what keeps me from doing this is the fact that I have not yet found an official Docker image that uses it.

  • Take mongo as an example: They call mongod directly.
  • Take postgres as an example: They call postgres directly.
  • Take node as an example: They call node directly.

If dumb-init is so important - why is apparently nobody using it? What am I missing here?

like image 375
Golo Roden Avatar asked May 22 '16 12:05

Golo Roden


People also ask

What does Docker init do?

The docker app init command is used to initialize a new Docker application project. If you run it on its own, it initializes a new empty project. If you point it to an existing docker-compose. yml file, it initializes a new project based on the Compose file.

Is singularity better than Docker?

Singularity is a Secure Alternative to Docker Docker images are not secure because they provide a means to gain root access to the system they are running on.

Does Docker slow down performance?

The performance of the host machine influences the containers performance. A slow CPU or insufficient RAM can become a bottleneck, slowing down Docker's performance. When you experience slow Docker performance, check your CPU, memory usage, and available disk space.


1 Answers

Something like dumb-init or tini can be used if you have a process that spawns new processes and you doesn't have good signal handlers implemented to catch child signals and stop your child if your process should be stopped etc.

If your process doesn't spawn new processes (e.g., Node.js) then this may not be necessary.

I guess that MongoDB, PostgreSQL, ... which may run child processes have good signal handlers implemented. Otherwise there would have been zombie processes and someone had filed an issue to fix this.

Only problem may be the official language images, like node, ruby, golang. They don't have dumb-init/tini in it as you normally don't need them. But it's up to the developer which may implement bad child execution code to either fix the signal handlers or use helper as PID 1.

like image 183
Stefan Scherer Avatar answered Sep 21 '22 03:09

Stefan Scherer