explaingit

krallin/tini

11,073CAudience · ops devopsComplexity · 2/5Setup · easy

TLDR

Tini is a tiny init process for Docker containers that cleans up zombie processes and ensures Docker stop signals actually reach your running application, with near-zero overhead.

Mindmap

mindmap
  root((tini))
    What it does
      Reaps zombie processes
      Forwards signals
    Installation
      Docker --init flag
      Add to Dockerfile
      Linux packages
    Platforms
      x86-64
      32-bit
      ARM
    Options
      Verbosity flag
      Subreaper mode
      Exit code remap
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

Add Tini to a Docker image to fix zombie process accumulation in long-running containerised services.

USE CASE 2

Ensure SIGTERM from Docker stop reaches your application instead of being silently dropped.

USE CASE 3

Use subreaper mode when Tini cannot run as PID 1 so orphaned processes are still reparented to it.

Tech stack

C

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Tini is a very small program designed to run as the first process inside a container. When you start a container, something needs to act as the "init" process: the parent of all other processes, responsible for basic housekeeping. Tini fills that role with almost no overhead. The two main jobs Tini handles are reaping zombie processes and forwarding signals. Zombie processes are programs that have finished running but whose exit status was never collected by a parent process. If they pile up over time they consume process ID slots, which can eventually make the whole system unresponsive. Tini automatically collects those exit statuses so zombies never accumulate. Signal forwarding means that when you tell Docker to stop a container, the stop command actually reaches your running program rather than getting lost. If you are using Docker version 1.13 or newer, Tini is already bundled with Docker. You can activate it simply by adding the flag --init when running a container, with no installation required. For older setups or images where you want it explicitly present, you can download the Tini binary, add it to your container, and set it as the entrypoint so your actual program runs underneath it. Packages are also available for Alpine Linux, Debian, NixOS, and Arch Linux. Tini has a handful of optional settings. You can enable extra log output with a verbosity flag. If Tini cannot run as the first process (process ID 1), a subreaper mode tells the operating system to reparent orphaned processes to Tini anyway. A separate option lets Tini kill an entire process group when it receives a signal, which is useful when a parent process does not pass signals down to its children on its own. There is also a flag to remap specific exit codes, which helps with programs that return unusual codes on a normal shutdown. The project is written in C, ships signed and checksum-verified binaries for x86-64, 32-bit, and ARM platforms, and has no runtime dependencies beyond the standard C library.

Copy-paste prompts

Prompt 1
Write a Dockerfile that installs Tini as the entrypoint so my Node.js app receives SIGTERM when the container stops gracefully.
Prompt 2
My Docker container accumulates zombie processes over time. How do I add Tini to fix this without rebuilding from scratch?
Prompt 3
Explain the difference between using the --init flag in docker run versus installing Tini explicitly in the Dockerfile.
Prompt 4
Show me how to configure Tini's process-group kill mode for a container where the parent process does not forward signals to its children.
Open on GitHub → Explain another repo

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

Verify against the repo before relying on details.