Interview Prep/Docker/Limits, logging, health checks and restarts

Container is in a restart loop. How do you triage quickly?

BeginnerScenarioLimits, logging, health checks and restarts
Answer

Situation read → Process exits immediately and restart policy keeps trying.

What I'd do →

docker ps -a
docker logs --tail 100 c
docker inspect -f '{{.State.ExitCode}} {{.State.OOMKilled}} {{.State.Error}}' c

Run it without restart policy and with an overridden entrypoint: docker run --rm -it --entrypoint sh image.

Why → Exit code 137 = SIGKILL (OOM?), 1 = app error, 126/127 = command not executable/not found.

Interview tip → Read exit codes fluently.

All Docker questions Roadmap: Docker & containers

More on Limits, logging, health checks and restarts