Troubleshoot a Failing Container
A 5-step recipe with Docker. We can help you get access.
Recipe · 5 steps
Troubleshoot a Failing Container
with Docker
Collect state, logs, processes, stats, and filesystem changes for one container.
- Read the container's low-level state, including whether it is running, its exit code, OOM-killed flag, restart count, and health status. This is the anchor for the whole diagnosis.
- Tail both stdout and stderr with timestamps so the failure can be placed on a timeline against the state transitions above.
- List the processes running inside the container. An empty or unexpected process table often explains a container that is "running" but idle. This endpoint is not supported on Windows containers.
- Take a single resource sample rather than opening the default stats stream, so the workflow terminates. Memory and CPU here corroborate an OOM kill seen in the inspect state.
- Report which files have been added, modified, or deleted relative to the image layer. Unexpected writes here point at state that will be lost on recreate, or at a container being used as a pet.
What you'll need to have ready
- containerId: ID or name of the container to diagnose.
- tail: Number of log lines to return from the end of the logs, or "all".
- since: Only return logs since this UNIX timestamp.
For your developer
Arazzo workflow docker:troubleshoot-container, 5 operations: ContainerInspect → ContainerLogs → ContainerTop → ContainerStats → ContainerChanges. Specs on APIs.io.