Running a process as PID 1 in a container has side effects. The most common is the “Zombie Process” problem.
The Problem
In Linux, only PID 1 can reap orphaned child processes. If your app (e.g., Node.js or Java) runs as PID 1 but doesn’t handle `SIGCHLD` signals, zombies accumulate, exhausting the process table.
The Solution: Tini
Use `tini` as your entrypoint. It acts as a lightweight init system.
# Add tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# Run your program
CMD ["node", "app.js"]
Or simply use `–init` when running `docker run`.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.