dumb-init: Simple Init System for Docker

Discovered dumb-init for handling process signals properly in Docker containers.

The Problem

Docker containers often run a single process as PID 1. But PID 1 has special responsibilities in Unix:

Most applications aren’t designed to be PID 1. They don’t handle these tasks correctly.

What dumb-init Does

dumb-init is a minimal init system that:

By Yelp, battle-tested in production.

Usage

In Dockerfile:

FROM ubuntu:latest

# Install dumb-init
RUN apt-get update && apt-get install -y dumb-init

# Use dumb-init as entrypoint
ENTRYPOINT ["dumb-init", "--"]

# Your application
CMD ["python", "app.py"]

Or with Alpine:

FROM alpine:latest

RUN apk add --no-cache dumb-init

ENTRYPOINT ["dumb-init", "--"]
CMD ["./myapp"]

What It Fixes

Without dumb-init:

With dumb-init:

Alternative: --init Flag

Docker has built-in init:

docker run --init myimage

Uses tini under the hood. Similar to dumb-init.

But if you want explicit control in your Dockerfile, use dumb-init directly.

When You Need It

Use an init system when:

Small tool, solves real problems.