Docker init

Updated: 08 May 2023

Run an init inside a container which forwards signals and reaps processes. Configure in a Dockerfile

FROM mcr.microsoft.com/dotnet/sdk
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        tini \
    && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/bin/tini", "--"]

or docker-compose.yml

services:
  web:
    image: alpine:latest
    init: true

https://github.com/krallin/tini

Tini is the simplest init you could think of. All Tini does is spawn a single child (Tini is meant to be run in a container), and wait for it to exit all the while reaping zombies and performing signal forwarding.

Leave a comment