
docker-troubleshooting
Guidance for debugging and troubleshooting Docker issues. Covers container startup failures (exit codes, docker logs, inspect), disk space exhaustion (system df/prune, log rotation), OOM and resource pressure (memory limits, stats), network connectivity problems (network inspect, iptables, DNS resolution), storage issues (permission denied, volume inspection), daemon problems (dockerd startup, socket permissions), and common error diagnosis. Use when the user asks about docker troubleshooting, docker debug, OOM, disk full, network issues, docker not starting, container crash, or needs to investigate Docker problems. 使用场景:docker 排查、docker debug、容器问题、OOM、磁盘满、网络不通、启动失败、配置问题.
- Installs
- 118
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/full-stack-skills/docker-skills --skill docker-troubleshooting- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads docker-troubleshooting automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Docker Troubleshooting — 问题排查与调试
Systematic approach to diagnosing and resolving common Docker issues.
When to Use
ALWAYS use this skill when the user mentions:
- "docker 排查", "docker debug", "容器问题"
- "容器启动失败", "exit code", "crash"
- "OOM", "磁盘满", "disk full"
- "网络不通", "network issues"
- "docker daemon", "daemon not running"
Diagnostic Framework
1. Check container state → docker ps -a, docker inspect
2. Check logs → docker logs --tail 100
3. Check resources → docker stats, docker system df
4. Check exit code → docker inspect --format='{{.State.ExitCode}}'
5. Interactive debug → docker run --rm -it image sh
Container Startup Failure
Exit Code Reference
| Code | Meaning | Action |
|---|---|---|
| 0 | Success | — |
| 1 | Application error | Check docker logs |
| 125 | Docker daemon error | Check daemon status |
| 126 | Command cannot execute | Check permissions |
| 127 | Command not found | Check CMD/ENTRYPOINT path |
| 137 | SIGKILL (OOM or docker kill) | Check memory limits |
| 139 | SIGSEGV (segfault) | Application bug |
| 143 | SIGTERM (graceful stop) | Health check timeout? |
# Quick diagnosis
docker ps -a | grep Exited
docker inspect --format='{{.State.ExitCode}} {{.State.Error}}' container
docker logs container
Disk Space Exhaustion
# Check disk usage
docker system df
# What's using space?
docker system df -v # Verbose breakdown
# Clean up
docker system prune -a # Remove all unused: images, containers, volumes, networks
docker image prune -a # Unused images only
docker volume prune # Unused volumes only
# Log rotation (prevent future issues)
docker run --log-opt max-size=10m --log-opt max-file=3 myapp
OOM (Out of Memory)
# Check if container was OOM-killed
docker inspect --format='{{.State.OOMKilled}}' container
# Check memory usage
docker stats --no-stream
# Solution: increase memory limit
docker update --memory=1g --memory-swap=1g container
Network Connectivity
# Check network configuration
docker network inspect bridge
docker exec container ip addr show
docker exec container ping other-container
# DNS check
docker exec container nslookup other-container
docker exec container cat /etc/resolv.conf
# Host networking check
iptables -t nat -L DOCKER -n # Port forwarding rules
Permission Issues
# Bind mount permission denied
# Solution 1: Match UID
docker run -u $(id -u):$(id -g) -v $PWD:/app myapp
# Solution 2: Fix permissions in entrypoint
# In entrypoint script: chown -R appuser:appgroup /data
# Docker socket permission
sudo usermod -aG docker $USER # Add user to docker group
newgrp docker # Refresh group (or re-login)
Workflow — 排查流程
Step 1: 查看状态: docker ps -a → 确认退出码和 OOMKilled
Step 2: 查看日志: docker logs --tail 100 <container> 获取错误信息
Step 3: 深入检查: docker inspect → 检查网络/挂载/资源限制
Step 4: 交互调试: docker run -it --rm --entrypoint sh <image> 进入排查
Step 5: 资源排查: docker stats + docker system df 检查 CPU/内存/磁盘
Gotchas — Common Pitfalls
docker system pruneis destructive: Removes ALL unused objects. Don't run blindly in production. → Recovery: Usedocker system dffirst to preview; add--filter "until=24h"for safe cleanup; never runprune -awithout confirmation.- Logs fill disk silently: JSON-file driver has NO rotation by default. A noisy app can fill the disk in hours. → Recovery:
docker run --log-opt max-size=10m --log-opt max-file=3 app; existing:truncate -s 0 $(docker inspect -f '{{.LogPath}}' myapp). - OOMKilled=TRUE but no error in logs: SIGKILL can't be logged. → Recovery: Check
docker inspect -f '{{.State.OOMKilled}}' myapp; increase memory:docker update --memory 512m myapp. - Exited (0) but service not working: Application started but crashed after health check passed. → Recovery:
docker logs --tail 100 myapp; check if app listens on 0.0.0.0 (not 127.0.0.1); verify withdocker exec myapp netstat -tlnp.
Boundary — 能力边界(适用与不适用场景)
| 分类 | 场景 | 说明 |
|---|---|---|
| ✅ 能做 | 容器启动失败排查 | 退出码分析 + docker logs + inspect |
| ✅ 能做 | 磁盘/日志/资源问题 | docker system df + prune + log rotation |
| ✅ 能做 | OOM/CPU 排查 | docker stats + --memory 限制 + OOMKilled |
| ⚠️ 需条件 | 网络包级分析 | 需 tcpdump/Wireshark + 网络知识 |
| ⚠️ 需条件 | 内核级问题 | 需 Linux 内核调试技能 |
| ❌ 超范围 | 应用代码 bug 修复 | 开发者修复代码 |
| ❌ 超范围 | 生产环境部署 | 使用 docker-production |
| ❌ 超范围 | 安全漏洞修复 | 使用 docker-security + docker-scout |
When NOT to Use This Skill
| ❌ Skip | ✅ Use Instead |
|---|---|
| Setting up production | docker-production |
| Security issues | docker-security |
| Performance tuning | docker-run (resource limits) |
| Docker basics | docker-basics |
Security & Stability
docker execinto production containers can expose sensitive data. Prefer log-based debugging.docker system prune -aremoves ALL unused images and volumes — use with caution in production.- Inspecting containers with
--privilegeddebug tools can bypass security controls. - Never expose Docker socket (
/var/run/docker.sock) to containers for debugging — it grants root access. - Rotate debug logs — they may contain sensitive information. Use log drivers with TTL.
📚 官方文档参考
| 文档 | 地址 |
|---|---|
| Docker 引擎故障排查 | https://docs.docker.com/engine/troubleshoot/ |
| docker logs 命令 | https://docs.docker.com/reference/cli/docker/container/logs/ |
| docker inspect | https://docs.docker.com/reference/cli/docker/inspect/ |
| Docker CLI 参考 | https://docs.docker.com/reference/cli/docker/ |
| 守护进程配置 | https://docs.docker.com/reference/cli/dockerd/ |
| 常见问题 FAQ | https://docs.docker.com/faq/ |
🧭 Docker Skills Journey
📍 You are here:
docker-troubleshooting— 问题排查
← Previous: docker-production
FAQ
What does the docker-troubleshooting skill do?
Guidance for debugging and troubleshooting Docker issues. Covers container startup failures (exit codes, docker logs, inspect), disk space exhaustion (system df/prune, log rotation), OOM and resource pressure (memory limits, stats), network connectivity problems (network inspect, iptables, DNS resolution), storage issues (permission denied, volume inspection), daemon problems (dockerd startup, socket permissions), and common error diagnosis. Use when the user asks about docker troubleshooting, docker debug, OOM, disk full, network issues, docker not starting, container crash, or needs to investigate Docker problems. 使用场景:docker 排查、docker debug、容器问题、OOM、磁盘满、网络不通、启动失败、配置问题.
How do I install docker-troubleshooting?
Run npx skills add https://github.com/full-stack-skills/docker-skills --skill docker-troubleshooting in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/docker-troubleshooting/ (personal) or .claude/skills/docker-troubleshooting/ (project).
Which AI agents can use docker-troubleshooting?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is docker-troubleshooting safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains docker-troubleshooting?
It is published by full-stack-skills in full-stack-skills/docker-skills. It has 118 recorded installs.
More from full-stack-skills/docker-skills
docker-compose
full-stack-skills/docker-skills
Expert guidance for Docker Compose — writing production-grade compose.yml files for multi-container applications. Covers complete Compose file syntax (services, networks, volumes, secrets, configs, profiles, extends, include), service configuration (image/build, ports, environment, envfile, dependson with health checks, deploy resources, restart policies), networking in Compose (default networks, custom networks, internal networks), volume management, environment variable strategies (.env vs environment vs envfile), override files for multi-environment, profiles for optional services, and migration to Kubernetes with kompose. Use when the user asks about docker compose, docker-compose.yml, compose file, multi-container, service orchestration, compose configuration, or needs to write/modify a compose file. 使用场景:docker compose、docker-compose.yml、compose 文件、多容器、服务编排、compose 配置、dependson、profiles.
docker-dockerfile
full-stack-skills/docker-skills
Expert guidance for Dockerfile authoring — the complete reference for writing production-grade Dockerfiles. Covers every instruction (FROM/RUN/COPY/ADD/ENV/ARG/WORKDIR/EXPOSE/CMD/ENTRYPOINT/USER/HEALTHCHECK/SHELL) with syntax, best practices, and common mistakes. Includes multi-stage build patterns (build+scratch, build+alpine, builder pattern), layer caching optimization strategies, .dockerignore rules, and language-specific production templates (Go/Rust/Java Spring Boot/Python FastAPI/Node.js Express/TypeScript). Use when the user asks about Dockerfile, how to write a Dockerfile, multi-stage build, layer optimization, or needs Dockerfile examples for a specific language. 使用场景:Dockerfile 编写、怎么写 Dockerfile、Dockerfile 指令、多阶段构建、multi-stage、层优化、layer cache、Dockerfile 模板.
docker-security
full-stack-skills/docker-skills
Guidance for Docker security hardening across the full lifecycle — image security (minimal base images, non-root users, pinned versions), runtime security (seccomp/AppArmor/SELinux, capabilities, read-only rootfs, no-new-privileges), secrets management (BuildKit secrets, Docker secrets in Swarm), Docker Bench Security auditing, CIS compliance checklist, and supply-chain security (image signing, content trust, SBOM). Use when the user asks about Docker security, image hardening, non-root containers, seccomp, AppArmor, Docker Bench, secrets management, or securing containers. 使用场景:docker 安全、镜像安全、非root运行、seccomp、AppArmor、security、Docker Bench、secret管理.
docker-networking
full-stack-skills/docker-skills
Guidance for Docker networking configuration and inter-container communication. Covers network modes (bridge/host/overlay/none/macvlan/ipvlan), custom bridge networks with DNS resolution, port publishing (-p/--publish), container linking and service discovery, network troubleshooting (inspect/ping/nslookup), overlay networks for Swarm, and network security (internal networks, encrypted overlay). Use when the user asks about docker network, container networking, bridge mode, port mapping, inter-container communication, network troubleshooting, or Docker network modes. 使用场景:docker network、容器网络、bridge、overlay、端口映射、容器通信、网络配置、网络排查.
docker-basics
full-stack-skills/docker-skills
Docker entry point — provides comprehensive guidance for Docker concepts, architecture, and basic operations. Covers what Docker is, container vs VM comparison, Docker architecture (Client-Server, daemon, registry), installation guidance for Linux/Mac/Windows, and first-container walkthrough. Includes Docker object model (Image/Container/Registry/Engine), CLI basics, and the Docker ecosystem overview. Use when the user asks about Docker basics, needs to understand Docker concepts, is new to Docker, or wants containerization fundamentals. 使用场景:Docker 入门、什么是 Docker、容器概念、Docker vs VM、Docker 安装、docker 基础命令、container basics、Docker 架构.
docker-buildx
full-stack-skills/docker-skills
Expert guidance for Docker image building — docker build CLI, buildx for multi-platform builds, BuildKit features (secret mounts, cache mounts, SSH forwarding, inline cache), Docker Build Cloud for accelerated cloud builds, layer caching strategies (--cache-from, --cache-to, GHA cache, registry cache), and CI/CD build optimization. Use when the user asks about docker build, buildx, multi-platform, multi-arch, linux/arm64, BuildKit, Build Cloud, Docker build acceleration, or build optimization. 使用场景:docker build、buildx、多平台构建、multi-platform、linux/arm64、BuildKit、Docker Build Cloud、构建加速、build optimization.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.