catatonit -
Introduction to Catatonit and Container Init Programs
Catatonit is a minimalist /sbin/init program designed specifically for Linux containers. It serves as PID 1 to forward signals to spawned processes, clean up orphan zombie processes, and tear down the container when the main process exits. As an open-source alternative to container init managers like tini and dumb-init, catatonit provides better stability and signal-handling correctness.
Key Features of Catatonit
- Signal Handling: Catatonit uses
signalfd(2)rather thansigwait(2), which provides better stability and signal-handling correctness compared to older implementations. - Zombie Process Cleanup: Automatically reaps adopted zombie processes to prevent memory/resource leaks in containers.
- Pause Mode: Includes a
-Pflag to run in a "pause container" state where no subprocess is spawned, and it simply waits to quit upon receiving a SIGINT.
How Catatonit Works
Catatonit is typically invoked as the main entry point for a container, wrapping the actual application to ensure proper process management. The command to invoke catatonit is:
catatonit -- <your-program> [<arguments>...]
Distribution and Availability
Catatonit is lightweight, has no additional complex features, and is commonly pre-packaged in container base images for distributions like openSUSE, Arch Linux, Debian, Fedora, and Rocky Linux. The source code and development can be tracked on the openSUSE GitHub Repository.
Popular Container Init Programs
Other popular container init programs include:
- tini: The most widely adopted init tool, famously built directly into Docker (invoked natively via the
docker run --initflag). - dumb-init: Created by Yelp, this is another highly popular, minimal init tool used to rewrite signal handlers and correctly forward signals to child processes.
- s6-overlay: A more robust, multi-process supervisory suite, typically baked directly into heavier or legacy containers that require multiple daemons to run concurrently.