Containers that exit immediately: process and state evidence
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 evidence to analyze, not a script to paste. Before any authorized observation confirm the actual endpoint, object identity, time window and output budget. Do not repair, restart or delete resources during this offline exercise.
Synthetic state summaries:A: batch job; exited; exit=0; output verifiedB: web service; exited; exit=1; required config absentC: worker; exited; exit=137; OOMKilled=false; cause unknownD: worker; exited; exit=137; OOMKilled=trueStaged checks:docker ps -a --filter name=bm-triagedocker inspect --format '{{.State.ExitCode}} {{.State.OOMKilled}}' bm-triagedocker logs --tail 20 bm-triageInspect the exact container ID before reading state or logs; a name filter can match more than one object. A is a valid result if its job output meets requirements. In B compare CMD, ENTRYPOINT, working directory and required configuration with the approved image contract. Check for missing executable or interpreter, incorrect arguments and stale image ID; inspect only necessary fields rather than dumping Env. A nonzero exit indicates failure according to the program contract. Exit 137 often indicates SIGKILL, but the code alone does not establish OOM; compare C and D and correlate events or cgroup/kernel evidence with the same container lifetime. CLI launch errors (such as Docker run 125, 126 or 127) are distinct from an application report; consult the actual command context. Once a scoped repair is approved, verify the workload output or readiness and record the previous image/config for rollback. The staged name-based inspect and log commands are illustrative; replace the name with the verified full ID before any authorized observation. Bound log bytes and duration as well as line count. The local worker exits 0 or 7; it does not reproduce Docker launch failures or an OOM kill.
Common mistake
Adding an infinite sleep or restart loop can hide the original error without restoring the actual service.
Manual practice
Classify A–D. Use the local process fixture to compare exit 0 and exit 7; explain what cannot be inferred about Docker from this host-side test.
Worksheet: lab-fixtures/docker-troubleshooting/05-container-exits/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Containers that exit immediately: process and state evidence — Knowledge check
Interpret synthetic incident evidence and choose safe diagnostic actions.
A batch job exits 0 and its output is verified. Is the completed state itself a failure?
Exit 137 alone establishes what?
What should you verify after repairing a web service?