Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
openaec-foundation avatar

Docker Errors Runtime

  • 9 installs
  • 9 repo stars
  • Updated July 8, 2026
  • openaec-foundation/docker-claude-skill-package

Helps with devops & ci/cd tasks.

About

docker-errors-runtime is a Claude Code skill for devops & ci/cd. It helps solo builders move faster with AI-assisted development.

  • docker-errors-runtime
  • DevOps & CI/CD
  • AI-coding skill

Docker Errors Runtime by the numbers

  • 9 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,020 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/openaec-foundation/docker-claude-skill-package --skill docker-errors-runtime

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs9
repo stars9
Last updatedJuly 8, 2026
Repositoryopenaec-foundation/docker-claude-skill-package

What it does

Helps with devops & ci/cd tasks.

Files

SKILL.mdMarkdownGitHub ↗

docker-errors-runtime

Quick Reference

Exit Code Reference

Exit CodeSignalMeaningCommon Cause
0SuccessContainer completed normally
1Application errorUncaught exception, failed assertion, general error
125Docker daemon errorContainer failed to start (invalid config, missing image)
126Command not executablePermission denied on entrypoint/cmd binary
127Command not foundBinary missing in image, wrong PATH, typo in CMD
137SIGKILL (9)KilledOOM killer, docker kill, or docker stop timeout
139SIGSEGV (11)Segmentation faultNative library crash, memory corruption
143SIGTERM (15)Graceful terminationdocker stop (process handled SIGTERM)

Critical Warnings

NEVER ignore exit code 137 — it ALWAYS indicates the container was forcefully killed. Check OOM events with docker inspect and dmesg before increasing memory limits blindly.

NEVER use --oom-kill-disable without setting a memory limit (-m) — the container can consume ALL host memory and crash the entire system.

NEVER assume a container that exits with code 0 is healthy — it may have completed a one-shot command instead of running as a long-lived service. ALWAYS verify the process runs in the foreground.

ALWAYS check docker logs before any other debugging step — 90% of runtime issues are explained in the application output.

ALWAYS use docker inspect --format='{{.State.ExitCode}}' to get the exact exit code — docker ps -a truncates status information.

---

Debugging Workflow

Step 1: Check Logs

# Last 100 lines
docker logs --tail 100 <container>

# Follow live output with timestamps
docker logs -f -t <container>

# Logs from last 5 minutes
docker logs --since 5m <container>

Step 2: Inspect Container State

# Exit code and error message
docker inspect --format='{{.State.ExitCode}}' <container>
docker inspect --format='{{.State.Error}}' <container>

# OOM killed?
docker inspect --format='{{.State.OOMKilled}}' <container>

# Full state as JSON
docker inspect --format='{{json .State}}' <container> | jq .

Step 3: Exec Into Running Container

# Interactive shell (if container is still running)
docker exec -it <container> sh
docker exec -it <container> bash

# Check filesystem, processes, network
docker exec <container> ps aux
docker exec <container> df -h
docker exec <container> cat /etc/resolv.conf

Step 4: Check System Events

# Events for specific container in last 10 minutes
docker events --since 10m --filter container=<container>

# OOM events specifically
docker events --filter event=oom --since 1h

# All die events
docker events --filter event=die --since 1h

Step 5: Resource Usage

# Live resource stats
docker stats <container>

# Single snapshot
docker stats --no-stream <container>

# System-wide disk usage
docker system df -v

---

Runtime Error Diagnostic Table

Container Exits Immediately (Exit Code 0 or 1)

SymptomCauseFix
Container exits with code 0 instantlyMain process runs in background (daemonizes)ALWAYS run the process in foreground mode. For nginx: CMD ["nginx", "-g", "daemon off;"]
Container exits with code 0 instantlyCMD is a shell command that completesUse a long-running process. For shell scripts: end with exec or tail -f /dev/null for debugging
Container exits with code 1Application startup failureCheck docker logs. Fix config, missing env vars, or dependency issues
Container exits with code 1Missing environment variablesALWAYS pass required env vars: docker run -e DB_HOST=db -e DB_PORT=5432

OOM Killed (Exit Code 137)

SymptomCauseFix
OOMKilled: true in inspect outputContainer exceeded memory limitIncrease limit: docker run -m 1g. Profile actual usage with docker stats first
Exit 137 but OOMKilled: falsedocker stop timeout exceeded (SIGKILL after grace period)Increase stop timeout: docker stop -t 30. Or fix application to handle SIGTERM faster
Exit 137 but OOMKilled: falseManual docker killCheck who/what killed the container via docker events
Host OOM killer triggersNo memory limit set, host runs out of RAMALWAYS set memory limits in production: -m 512m

Permission Denied

SymptomCauseFix
Permission denied on volume filesUID/GID mismatch between host and containerMatch UIDs: docker run -u $(id -u):$(id -g). Or chown in Dockerfile
Permission denied executing entrypointScript lacks execute permissionAdd in Dockerfile: RUN chmod +x /entrypoint.sh
Permission denied binding to port < 1024Non-root user cannot bind privileged portsUse port > 1024, or add --cap-add NET_BIND_SERVICE
Operation not permitted on system callMissing Linux capabilityAdd specific capability: --cap-add SYS_PTRACE for debugging. NEVER use --privileged

Port Already in Use

SymptomCauseFix
port is already allocatedAnother container using the same host portFind it: docker ps --format "{{.Names}}: {{.Ports}}". Stop or remap
bind: address already in useHost process using the portFind process: lsof -i :PORT or `ss -tlnp \
Port conflict after restartOld container not removedUse --rm flag, or docker rm -f <old-container> before starting

Exec Format Error

SymptomCauseFix
exec format errorArchitecture mismatch (e.g., ARM image on x86)Build for correct platform: docker buildx build --platform linux/amd64. Or pull correct image: docker pull --platform linux/amd64 nginx
exec format error on shell scriptMissing shebang (#!/bin/sh) in entrypoint scriptALWAYS add shebang as first line of entrypoint scripts
exec user process caused: no such file or directoryCRLF line endings in shell scriptConvert to LF: RUN sed -i 's/\r$//' /entrypoint.sh or use dos2unix. ALWAYS use LF in Dockerfiles and scripts
exec user process caused: no such file or directoryDynamically linked binary in scratch/distroless imageBuild with CGO_ENABLED=0 for static linking, or use alpine base

Read-Only Filesystem

SymptomCauseFix
Read-only file system write errorContainer started with --read-onlyAdd tmpfs for writable paths: --tmpfs /tmp --tmpfs /run. Or mount a volume for data directories
Application fails to write temp filesRead-only root FS without tmpfsMap writable paths: --read-only --tmpfs /tmp:size=64m --mount type=volume,src=data,dst=/app/data
Log file write failureRead-only FS, app writes to file instead of stdoutRedirect logs to stdout, or mount a volume for log directory

PID Limit and Resource Exhaustion

SymptomCauseFix
cannot allocate memory inside containerMemory limit reachedIncrease -m limit or optimize application memory usage
fork: Resource temporarily unavailablePID limit exceededIncrease --pids-limit. Default is unlimited; set to 200-500 for most apps
no space left on deviceContainer writable layer full, or host disk fullCheck docker system df. Prune unused resources: docker system prune. Write data to volumes, not container layer
Container extremely slowCPU throttlingCheck docker stats for CPU%. Increase --cpus limit

---

docker inspect for Debugging

Essential Inspect Commands

# Full state overview
docker inspect --format='{{json .State}}' <container> | jq .

# Why did it stop?
docker inspect --format='ExitCode={{.State.ExitCode}} OOM={{.State.OOMKilled}} Error={{.State.Error}}' <container>

# What command is it running?
docker inspect --format='Entrypoint={{.Config.Entrypoint}} Cmd={{.Config.Cmd}}' <container>

# Environment variables
docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' <container>

# Mount points
docker inspect --format='{{range .Mounts}}{{.Type}}: {{.Source}} -> {{.Destination}} ({{if .RW}}rw{{else}}ro{{end}}){{println}}{{end}}' <container>

# Network settings
docker inspect --format='{{range $net, $config := .NetworkSettings.Networks}}{{$net}}: {{$config.IPAddress}}{{println}}{{end}}' <container>

# Resource limits
docker inspect --format='Memory={{.HostConfig.Memory}} CPUs={{.HostConfig.NanoCpus}} PidsLimit={{.HostConfig.PidsLimit}}' <container>

# Health check status
docker inspect --format='{{.State.Health.Status}}' <container>
docker inspect --format='{{json .State.Health}}' <container> | jq .

# Restart count
docker inspect --format='RestartCount={{.RestartCount}}' <container>

---

Decision Trees

Container Won't Start

Container won't start
├─ Exit 125 → Docker daemon error
│  ├─ "invalid reference format" → Fix image name/tag
│  ├─ "no such image" → Pull image first: docker pull <image>
│  └─ "invalid mount config" → Fix volume/mount syntax
├─ Exit 126 → Command not executable
│  ├─ Check file permissions → chmod +x
│  └─ Check binary format → file <binary>
├─ Exit 127 → Command not found
│  ├─ Typo in CMD/ENTRYPOINT → Fix spelling
│  ├─ Binary not in PATH → Use absolute path
│  └─ Binary not installed → Add to Dockerfile
└─ Exit 0/1 instantly → See "Container Exits Immediately" table

Container Crashes After Running

Container was running, then died
├─ Exit 137 → Killed
│  ├─ OOMKilled=true → Memory limit too low (see OOM section)
│  ├─ OOMKilled=false, after docker stop → Stop timeout too short
│  └─ OOMKilled=false, unexpected → Check docker events + dmesg
├─ Exit 139 → Segfault
│  ├─ Native library issue → Check library compatibility
│  └─ Memory corruption → Debug with --cap-add SYS_PTRACE
├─ Exit 143 → Graceful SIGTERM
│  └─ Expected from docker stop → Normal shutdown
└─ Exit 1 → Application error
   └─ Check docker logs → Fix application bug

---

Reference Links

  • references/diagnostics.md -- Complete error-to-solution mapping for all runtime errors
  • references/examples.md -- Step-by-step debugging sessions with real commands
  • references/anti-patterns.md -- Runtime configuration mistakes and how to avoid them

Official Sources

  • https://docs.docker.com/engine/daemon/troubleshoot/
  • https://docs.docker.com/reference/cli/docker/container/run/
  • https://docs.docker.com/reference/cli/docker/container/logs/
  • https://docs.docker.com/reference/cli/docker/inspect/
  • https://docs.docker.com/reference/cli/docker/system/events/

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.