Debug a Docker container that exits or keeps restarting
8 steps · about 1 h 35 min · Beginner
- Read exit status and run options for a container (reference, Docker Docs, 15 min)
Explains what the exit codes 125, 126, 127 and the program's own code mean.
- Map container exit codes to likely causes (article, Komodor, 15 min)
Ties 137, 139, 143 and others to OOM kills, crashes and signals.
- Capture the exit code with docker wait (reference, Docker Docs, 5 min)
Blocks until the container stops and prints its exit code for scripts.
- Find where container output goes (reference, Docker Docs, 10 min)
Explains logging drivers so you know why logs may be missing.
- See what processes run inside the container (reference, Docker Docs, 5 min)
Confirms the main process is the one you expected.
- Open a shell in slim or stopped containers with docker debug (reference, Docker Docs, 10 min)
Adds tools to images that have no shell so you can inspect them.
- Debug distroless and slim containers (article, iximiuz Labs, 20 min)
Practical techniques for containers that ship without any debugging tools.
- Rule out problems in the Docker daemon itself (reference, Docker Docs, 15 min)
Covers daemon logs and common engine faults when the container is not to blame.