explaingit

yelp/dumb-init

7,276PythonAudience · ops devopsComplexity · 2/5Setup · easy

TLDR

dumb-init is a tiny static binary from Yelp that runs as the first process inside a Docker container, forwarding shutdown signals to your app and cleaning up zombie processes so containers shut down cleanly.

Mindmap

mindmap
  root((dumb-init))
    What it does
      Container init process
      Signal forwarding
      Zombie process cleanup
    How to use
      Prefix ENTRYPOINT
      Signal rewriting
      Static binary
    Installation
      Package manager
      Binary download
      pip install
    Use cases
      Docker containers
      Kubernetes pods
      Any Linux container
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Prefix your Docker ENTRYPOINT with dumb-init so your app actually receives stop signals and shuts down gracefully instead of hanging

USE CASE 2

Prevent zombie process accumulation in containers that spawn short-lived child processes

USE CASE 3

Rewrite one stop signal into another before forwarding it when your container orchestrator sends a different signal than your app expects

Tech stack

CPython

Getting it running

Difficulty · easy Time to first run · 5min

Static binary with no dependencies, add one line to your Dockerfile ENTRYPOINT, also installable via pip or package manager.

In plain English

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.

Copy-paste prompts

Prompt 1
Write a Dockerfile that installs dumb-init and uses it as the ENTRYPOINT prefix for a Node.js web server so it shuts down cleanly on docker stop.
Prompt 2
Show me how to configure dumb-init signal rewriting to translate SIGTERM into SIGUSR1 before forwarding it to my application.
Prompt 3
Explain in simple terms why running my Python app directly as PID 1 in a Docker container causes problems and how dumb-init fixes them.
Prompt 4
Write a Kubernetes deployment YAML where dumb-init wraps my Go binary to ensure graceful shutdown when the pod is terminated.
Open on GitHub → Explain another repo

← yelp on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.