docker-debug
Skill0 starsChanged 8 months agoMITView on GitHub
Diagnose why a Docker build is failing or why a container will not start or is crashing. Use when the user says a Docker build is broken, a container exits immediately, a container is in a restart loop, or they cannot understand error output from Docker.
- Reads credentials
In this repository6 other files it gives its agents.
- composeSkill
- dockerfileSkill
- helm-reviewSkill
- k8s-debugSkill
- manifestSkill
- rbac-reviewSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Ask for or locate the build output.
- Very specific: line 21
Read the Dockerfile to understand the build stages.
- Distinctive: line 23
Base image not found: verify the image name and tag spelling.
- Distinctive: line 24
Dependency install fails: check the lockfile, the base image variant (alpine is often missing native build tools), and network access …
- Very specific: line 25
COPY fails with "no such file": check the build context. If using .dockerignore, confirm the file is not excluded.
- Very specific: line 31
Run docker ps -a to find the container and its status.
- Very specific: line 32
Run docker logs <container> --tail 200 --timestamps and read the last lines.
- Very specific: line 33
Run docker inspect <container> and look at:
- Very specific: line 49
Run docker compose ps to see the status of every service in the stack.
- Very specific: line 50
Run docker compose logs --tail=200 --timestamps <service> for the failing service.
- Very specific: line 51
Run docker compose config to see the fully resolved configuration after env var substitution and profile merging.
- Distinctive: line 64
If the issue is ambiguous, list the two or three most likely causes with the one command that would confirm each.
- Very specific: line 87
Do not run destructive commands (docker rm, docker rmi, docker system prune, docker kill) without asking the user first.
- Distinctive: line 88
Do not guess blindly. If logs are not enough, ask for the specific output you need.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Diagnose Docker failures
Find the root cause of a Docker build or runtime failure and suggest a concrete fix.
Inputs
$ARGUMENTS is optional context: a container name or ID, an error message, or a file path to build output. If empty, ask the user which build or container is failing.
Investigation workflow
Build failure
- Ask for or locate the build output. Identify the last successful step and the first failing step.
- Read the
Dockerfileto understand the build stages. - Common build failures and what to check:
- Base image not found: verify the image name and tag spelling. Check network and registry auth.
- Dependency install fails: check the lockfile, the base image variant (alpine is often missing native build tools), and network access inside the build.
- COPY fails with "no such file": check the build context. If using
.dockerignore, confirm the file is not excluded. - Permission denied: usually a non-root user trying to write outside their HOME or outside the WORKDIR.
- "exec format error" at runtime: image architecture mismatch (for example arm64 image on amd64 host). Use
docker buildxwith--platform.
Runtime failure
- Run
docker ps -ato find the container and its status. - Run
docker logs <container> --tail 200 --timestampsand read the last lines. - Run
docker inspect <container>and look at:.State.ExitCodeand.State.Error.State.OOMKilled(true means out of memory).Config.Cmd,.Config.Entrypoint,.Config.Env.HostConfig.Mountsand.NetworkSettings.Ports
- Common runtime failures and what to check:
- Exit code 137: killed by OOM. Raise memory limit or reduce memory usage.
- Exit code 139: segfault. Check the image architecture.
- Exit code 126 or 127: command not found or not executable. Check
CMDandENTRYPOINTsyntax and the file permissions. - Restart loop with immediate exit: the process exits on startup. Read logs for the actual error.
- "port already allocated": another process is using the host port. Change the mapping or stop the other process.
- "no such file or directory" for a mounted volume: path typo or Windows path style mismatch.
- App reachable inside container but not from host: the app is binding to
127.0.0.1inside the container. It must bind to0.0.0.0.
Docker Compose failure
- Run
docker compose psto see the status of every service in the stack. - Run
docker compose logs --tail=200 --timestamps <service>for the failing service. Omit the service name to see logs from all services interleaved. - Run
docker compose configto see the fully resolved configuration after env var substitution and profile merging. This catches most "wrong value" surprises. - Common Compose-specific failures:
- Service stuck in "waiting" because
depends_ontarget is unhealthy: the other service has a failing healthcheck. Inspect it withdocker compose logs <dep>anddocker inspect <container>. - Env var not substituted: the
.envfile is missing, in the wrong directory, or the variable name does not match.docker compose configshows the resolved values. - Volume mount shows empty: host path typo, an unshared host path, or a path translation mismatch between the host OS and the container runtime.
- Service cannot reach another by DNS name: the two services are on different networks. Check the
networksblock and make sure both are attached to the same one. - "port is already allocated": another compose project or host process is using that port. Run
docker compose ps -aacross projects or change the host-side port mapping.
- Service stuck in "waiting" because
Output
- State the single most likely root cause in one short sentence.
- Show the exact output (3 to 10 lines) that supports the diagnosis.
- Give a concrete fix. If it needs a Dockerfile change, show the before and after lines.
- If the issue is ambiguous, list the two or three most likely causes with the one command that would confirm each.
Example diagnosis
Root cause: the container exits with code 127 because CMD points to a binary that does not exist in the runtime image.
Evidence:
$ docker logs my-api
/bin/sh: 1: node: not found
$ docker inspect my-api --format '{{.State.ExitCode}}'
127Fix: the runtime stage uses python:3.12-slim but the CMD runs node server.js. Change the runtime base image to node:20-alpine, or change the CMD to the correct entrypoint for Python.
Next step:
docker run --rm my-api which node || echo "node not in image"Do not
- Do not run destructive commands (
docker rm,docker rmi,docker system prune,docker kill) without asking the user first. - Do not guess blindly. If logs are not enough, ask for the specific output you need.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

