docker-debugginglisted
Install: claude install-skill riteshsonawane1372/devops-skills
# Docker Debugging
Find out what the container actually ran, in what environment, and why it stopped.
## Purpose
**Use this when:**
- A container exits immediately, or restarts repeatedly.
- A file that exists in the build is missing at runtime.
- The container cannot reach the network, or cannot be reached.
- Permission denied on a mounted volume.
- It works on one machine and not another.
**Do not use this when:**
- The container runs under Kubernetes and the symptom is scheduling or probes — use
`kubernetes-troubleshooting`.
- The question is image quality, size or security — use `container-image-review`.
**What this skill assumes:** Docker or a compatible runtime on the host. Commands are shown for
`docker`; `podman` and `nerdctl` accept the same arguments for everything used here.
## Operating Procedure
1. **Get the exit code and the reason.** `docker ps -a` and `docker inspect` give both.
2. **Read the logs, including from the exited container.** A stopped container keeps its logs until
it is removed.
3. **Establish what actually ran.** The effective entrypoint and command are frequently not what the
Dockerfile appears to say.
4. **Compare build-time and run-time.** Most "missing file" reports are a multi-stage build that
did not copy it, or a volume mounted over it.
5. **Check the boundaries**: network, mounts, users, and architecture.
6. **Reproduce interactively** with an overridden entrypoint — the fastest way to inspect a broken
image.
7. **F