Interview Prep/Docker/Containers, VMs & Isolation Internals

What is PID 1 in a container and why does it matter?

IntermediateConceptContainers, VMs & Isolation Internals
Answer

The first process in the PID namespace is PID 1. The kernel treats it specially: signals without a handler installed are ignored for PID 1 (so SIGTERM does nothing unless the app handles it), and PID 1 is expected to reap orphaned zombie children. Shell-form CMD makes /bin/sh PID 1, which does not forward signals. Use exec form or docker run --init (tini).

All Docker questions Roadmap: Docker & containers

More on Containers, VMs & Isolation Internals