Dumb-init
A simple process supervisor and init system for Docker containers.
Contents
Rationale
Most programs do not properly handle signals. This can lead to containers that respond to all signals as though they are SIGTERM, or containers that do not respect any signals and remain as zombies.
dumb-init is also capable of rewriting signals to change behavior, including suppression of a response. (Try rewriting a signal to 0, as in --rewrite 15:0.)
Installation
Many popular container base images offer a dumb-init package.
If that's not an option for any reason, dumb-init is a statically-compiled C program, so it can be downloaded directly from the GitHub releases. For example:
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_arm64 RUN chmod +x /usr/local/bin/dumb-init
Usage
When creating a Dockerfile, start with the below template:
# Runs "/usr/bin/dumb-init -- /my/script --with --args" ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/my/script", "--with", "--args"]