Use it when a container will not start, crashes, or cannot reach or be reached.
Container Troubleshooting
Container troubleshooting checks the container's state and logs, its image and configuration, resources, mounts and network, and the host's runtime.
1. Status and exit code: docker ps -a.
2. Logs: docker logs <c>.
3. Config: docker inspect <c> (env, mounts, ports).
4. Inside: docker exec -it <c> sh — process, files, getent hosts.
5. Host: disk, memory, daemon logs (journalctl -u docker).
state → logs → configuration → inside test → host resources
For Containers → Container Troubleshooting, continue with the first unproven Topic check: Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. If that boundary is healthy, advance to the adjacent check: Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
podman inspect <container>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
symptom/time → host/runtime → container identity/image/config → process/exit → namespace/cgroup → mount/storage → network/DNS → logs/readiness → original workload
Healthy evidence: the failure is reproducible, one first failing step is evidenced, the fix is minimal and the original workload plus adjacent regression test succeeds
Step 2 Commands Verify boundary
docker logs --tail 100 <ctr>
docker inspect <ctr> --format '{{.State.ExitCode}} {{.State.Error}}'
docker events --since 10m
Step 3 Verification and output interpretation Verify boundary
Verification chain. symptom/time → host/runtime → container identity/image/config → process/exit → namespace/cgroup → mount/storage → network/DNS → logs/readiness → original workload
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: restart/recreate temporarily clears symptoms, logs are treated as root cause, or running/healthy metadata masks external workload failure
Step 5 Common mistakes Narrow the fault
- Ignoring the container exit code.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Start with docker ps -a and docker logs. Exit codes, OOMKilled and restart counts tell a lot. Test from inside the container to separate app from network problems.
docker ps -a / podman ps -a— containers and statedocker logs <c>— container outputdocker inspect <c>— configuration, mounts, networkdocker info— engine, storage driver, cgroup version
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Troubleshooting closes at the first failed container boundary and only after the original workload passes after a minimal persistent correction.
In depth
Why did the container stop?
$ docker ps -a --filter name=web --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'
NAMES STATUS IMAGE
web Exited (137) 2 minutes ago nginx:1.27
$ docker inspect web --format '{{.State.ExitCode}} OOMKilled={{.State.OOMKilled}} Error={{.State.Error}} Restarts={{.RestartCount}}'
137 OOMKilled=true Error= Restarts=4
$ docker logs --tail 50 --timestamps web
docker inspect returns the full JSON for a container and accepts Go templates via --format.
| Exit code | Meaning |
|---|---|
| 0 | Main process ended normally (container finished its job) |
| 1 / other small numbers | Application error — read the logs |
| 125 | Docker could not run the container (bad option) |
| 126 / 127 | Command not executable / not found in the image |
| 137 | Killed with SIGKILL — OOMKilled=true means memory limit, otherwise docker kill or host OOM |
| 143 | SIGTERM — normal stop |
The main-process rule
A container lives exactly as long as its PID 1. A daemon that forks into the background makes the container exit immediately with code 0. Run services in the foreground (nginx -g 'daemon off;').
Inspect from the inside and the outside
| Question | Command |
|---|---|
| Resource usage | docker stats --no-stream web |
| Network and ports | docker inspect web --format '{{json .NetworkSettings.Networks}}', docker port web |
| Mounted volumes | docker inspect web --format '{{json .Mounts}}' |
| Shell in the running container | docker exec -it web sh |
| Process from the host's view | docker top web; ps -o pid,cmd -p $(docker inspect -f '{{.State.Pid}}' web) |
| Daemon errors | journalctl -u docker --since -15min |
Common faults
| Fault | Clue |
|---|---|
| Port published but not reachable | Service listens on 127.0.0.1 inside the container instead of 0.0.0.0 |
| Permission denied on a bind mount | UID inside the container differs from file owner on the host; SELinux label (:Z) on RHEL-family hosts |
| DNS fails inside containers | Host resolver is 127.0.0.53 (systemd-resolved stub) — Docker substitutes upstream servers; check /etc/resolv.conf in the container |
| Disk full on the host | docker system df; prune unused images/volumes deliberately |
*The container exit code and OOMKilled flag are illustrative diagnostics, not a record of an actual container termination.*
How it works at runtime
Container Troubleshooting is part of Containers → Container Troubleshooting. Container Troubleshooting isolates failures from host/runtime and image identity through namespace/resource, mount/network and process/readiness boundaries to the original application request.
Topic-specific state model. Container Troubleshooting isolates failures from host/runtime and image identity through namespace/resource, mount/network and process/readiness boundaries to the original application request.
Method
Container troubleshooting:
| Symptom | Check |
|---|---|
| Exits immediately | docker logs, entrypoint/command, missing env/config |
| Exit 137 / OOMKilled | Memory limit, app memory |
| Restart loop | Health check, dependency not ready |
| Port not reachable | -p mapping, app listening on 127.0.0.1 inside container, host firewall |
| Permission denied on volume | UID/GID mismatch, SELinux (:Z), read-only mount |
| DNS fails between containers | Default bridge has no name resolution — use user-defined network |
docker inspect app --format '{{json .State}}' | jq
docker events --since 10m
nsenter -t $(docker inspect -f '{{.State.Pid}}' app) -n ss -ltnp
Limits and how it fails
Primary failure point. Troubleshooting closes at the first failed container boundary and only after the original workload passes after a minimal persistent correction.
Snapshot/image existence is not a verified backup.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Container Troubleshooting owns isolation and hands off to Docker, Linux Networking, Storage, Security or application Topics once confirmed.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Containers → Container Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.docker.com/engine/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Container Troubleshooting operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Container Troubleshooting.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Container Troubleshooting isolates failures from host/runtime and image identity through namespace/resource, mount/network and process/readiness boundaries to the original application request. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin host + object identity + source image/definition → verify host/runtime capability → read back effective process/namespace/cgroup or virtual-hardware state → verify storage/network attachments → verify guest/container readiness → repeat original workload + regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | symptom/time → host/runtime → container identity/image/config → process/exit → namespace/cgroup → mount/storage → network/DNS → logs/readiness → original workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Troubleshooting closes at the first failed container boundary and only after the original workload passes after a minimal persistent correction. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux container/virtualization evidence can establish this proof path: symptom/time → host/runtime → container identity/image/config → process/exit → namespace/cgroup → mount/storage → network/DNS → logs/readiness → original workload | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved clients, names, identities, routes, sessions, backends or time periods. Troubleshooting closes at the first failed container boundary and only after the original workload passes after a minimal persistent correction. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven runtime boundary, capture adjacent host/object/resource/attachment evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check. | Continue to the next unresolved boundary while preserving the original test condition. |
Container Troubleshooting · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Container Troubleshooting |
|---|---|
| Topic path | Containers → Container Troubleshooting |
| Runtime state | Container Troubleshooting isolates failures from host/runtime and image identity through namespace/resource, mount/network and process/readiness boundaries to the original application request. |
| Fast checks | - Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. - Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. - Trace storage and network attachments plus readiness from the real client or dependent workload path. - Apply the smallest persistent change, then repeat the original workload and an adjacent regression check. |
| Verification chain | symptom/time → host/runtime → container identity/image/config → process/exit → namespace/cgroup → mount/storage → network/DNS → logs/readiness → original workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | Troubleshooting closes at the first failed container boundary and only after the original workload passes after a minimal persistent correction. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |