Prefix your Docker ENTRYPOINT with dumb-init so your app actually receives stop signals and shuts down gracefully instead of hanging
Prevent zombie process accumulation in containers that spawn short-lived child processes
Rewrite one stop signal into another before forwarding it when your container orchestrator sends a different signal than your app expects
Static binary with no dependencies, add one line to your Dockerfile ENTRYPOINT, also installable via pip or package manager.
dumb-init is a tiny program designed to run as the first process inside a Linux container, such as a Docker container. It solves two specific problems that come up when you run an application directly as the first process in a container without any traditional init system in place. The first problem is signal handling. When you stop a Docker container, the operating system sends a signal to the container's first process asking it to shut down. If your application is not specifically written to handle that signal, nothing happens and the container hangs. dumb-init sits between the operating system and your application, catches those signals, and forwards them to your process in a way that causes normal default behavior, such as actually stopping when asked. The second problem is zombie processes. When a subprocess finishes but its parent does not properly acknowledge that it finished, the finished process lingers in a special state called a zombie. In a normal operating system, the init process (the first process, which is always running) handles these automatically. In a container without an init process, zombies can accumulate. dumb-init takes on that cleanup responsibility. Using it is straightforward: instead of running your application directly, you prefix it with dumb-init. For example, instead of running your web server directly, you run dumb-init followed by your web server command. dumb-init starts your process as its child and handles all the signal and zombie management from that point on. dumb-init also supports signal rewriting, which lets you translate one type of stop signal into another before forwarding it to your application. This is useful when a container orchestration system always sends a particular signal but your application expects a different one to start a clean shutdown. The binary is statically linked, meaning it has no external dependencies and can be dropped into any Linux container image directly. Installation options include a package manager, a downloaded binary, or a Python package via pip. Yelp originally created and open-sourced this tool.
← yelp on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.