PID 1, signals and child reaping
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Treat the worksheet as offline evidence. Before any separately authorized server query, verify the effective endpoint and its trust boundary, including context overrides. Do not change runtime state, mount host data or modify Desktop settings in this exercise.
Synthetic process tree:A: PID 1 = application; child PID 7 exitsB: PID 1 = init helper; child PID 7 = application; child PID 8 exitsStop request: configured termination signal, then timeout fallback if still runningStaged Docker option: --initAn exited child can remain a zombie until its parent obtains its exit status with a wait operation. Orphaned descendants may be adopted by a subreaper or namespace init. The namespace init process receives special signal treatment; application-specific handlers and signal forwarding matter. Docker stop sends the configured stop signal (normally SIGTERM) and may force termination when the timeout expires. A suitable init helper, for example Docker’s supported --init option, can forward signals and reap adopted children; it does not make an application save data or wait for its own children correctly. In A the application must take responsibility for these behaviors. In B the helper can assist, but the application must still implement graceful shutdown. No actual PID namespace is created in this worksheet. Collect evidence of graceful termination before the deadline and verify persisted data independently. A helper can reap descendants that become its children, not arbitrary children whose living parent neglects wait. An exit code alone is not proof of data durability.
Common mistake
An init helper does not replace application-specific shutdown logic.
Manual practice
Write expected shutdown evidence for both trees: signal handled, application exit, child status collected and persisted data verified. Explain why a forced stop is not proof of success.
Worksheet: lab-fixtures/docker-container-internals/07-pid-one/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
PID 1, signals and child reaping — Knowledge check
Interpret synthetic runtime and isolation evidence and explain kernel and OCI boundaries.
What releases an exited child’s zombie process entry?
What can a suitable init helper assist with?
What may happen after a stop timeout expires?