Docker Compose service state investigation cheat sheet
Inspect the effective Compose service model, container state and recent service logs.
Docker Compose v2 in a trusted project directory, connected to the intended Docker daemon.
Updated · Docker · 6 min read
| Command | What it does |
|---|---|
docker context show | Confirm the active Docker context |
docker compose config --services | List services in the effective model |
docker compose config --quiet | Validate the effective Compose model |
docker compose ps --all | Inspect project container states |
docker compose logs --since 30m --tail 100 --timestamps web | Inspect a bounded service log window |
Walkthrough
Use the same Compose files, project name and environment as the deployment. Configuration and logs can expose secrets; these commands do not start, stop or recreate services.
Step 1: Confirm the active Docker context
docker context show
Compare the context with the deployment host. Environment or command-line endpoint overrides may change the actual daemon, so confirm the approved operating context before drawing conclusions.
Step 2: List services in the effective model
docker compose config --services
Run from the intended project and compare the resulting service names with deployment documentation. File selection, profiles and environment can change the model.
Step 3: Validate the effective Compose model
docker compose config --quiet
This checks whether Compose can parse and resolve the model without printing it. A valid model does not prove that images, networks, credentials or application dependencies work.
Step 4: Inspect project container states
docker compose ps --all
Compare the service name, state and exit information with the expected project. This view depends on the selected project; an empty result does not establish that no containers exist on the daemon.
Step 5: Inspect a bounded service log window
docker compose logs --since 30m --tail 100 --timestamps web
Replace web with the affected service and correlate the first relevant error with the failure time. Logging driver and retention settings affect availability; redact secrets before sharing.
WORKED INCIDENT
Practical case: A Compose service exits after a configuration change
Fictional teaching scenario; observations are examples, not captured production output.
Situation
A web service exits immediately after a deployment configuration update.
Investigation sequence
1. Confirm the active Docker context
docker context showConfirm the active daemon and intended Compose project before investigation.
2. List services in the effective model
docker compose config --servicesList effective services using the same files and project context as the deployment.
3. Inspect project container states
docker compose ps --allCapture the affected container state and exit information.
4. Inspect a bounded service log window
docker compose logs --since 30m --tail 100 --timestamps webReview the bounded service logs around the first failed start.
Example findings
Illustrative findings: the intended project contains web, its container exits, and its logs report a missing required setting.
Interpret the findings
A missing application setting is the leading hypothesis in this example. Compose model validation alone cannot establish that application-level settings are sufficient.
Verify the outcome
After the owner corrects the deployment through the approved process, verify stable container state and a normal service request.
Escalation handoff
Provide context, project, service name, exit time and a sanitized error excerpt to the application owner.
Primary references
Documented reference; examples above are teaching scenarios. Confirm behavior against your deployed version.