Token导航 LogoToken导航TokenDH.com
研究检索权限需确认github未标认证来源可访问clear审计未展示

debug_docker调试 Docker

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

989

周安装

40

GitHub Stars

公开资料未说明

下载量

310
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:debug_docker(调试 Docker)
来源仓库:https://github.com/snakeo/claude-debug-and-refactor-skills-plugin
仓库路径:skills/debug_docker
安装命令:
npx skills add snakeo/claude-debug-and-refactor-skills-plugin --skill "debug:docker"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add snakeo/claude-debug-and-refactor-skills-plugin --skill "debug:docker"

简介

debug_docker 用于容器化应用的调试与运维支持,涵盖镜像、网络和编排管理。

  • 适合检查配置、分析资源状态或生成排障思路。debug_docker 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 需明确目标环境与账号权限,区分本地与生产操作。
  • 涉及删除或重启服务时,应提前评估影响范围。
  • 建议配合日志和监控工具使用,提高问题定位精度。

SKILL.md

Docker Debugging Guide

This guide provides a systematic approach to debugging Docker containers, images, networks, and volumes. Follow the four-phase methodology for efficient problem resolution.

The Four Phases of Docker Debugging

Phase 1: Quick Assessment (30 seconds)

Get immediate context about the issue.

# Check container status
docker ps -a

# View recent logs (last 50 lines)
docker logs --tail 50 <container>

# Check container exit code
docker inspect <container> --format='{{.State.ExitCode}}'

# Quick health check
docker inspect <container> --format='{{.State.Health.Status}}'

Phase 2: Log Analysis (2-5 minutes)

Deep dive into container logs and events.

# Follow logs in real-time
docker logs -f <container>

# View logs with timestamps
docker logs --timestamps <container>

# View logs since specific time
docker logs --since 30m <container>

# Check Docker daemon events
docker events --since 1h

# View system-wide logs
journalctl -u docker.service --since "1 hour ago"

Phase 3: Interactive Investigation (5-15 minutes)

Get hands-on access to the container environment.

# Open shell in running container
docker exec -it <container> /bin/sh
# or
docker exec -it <container> /bin/bash

# Run commands without shell
docker exec <container> cat /etc/hosts
docker exec <container> env

# Use docker debug for enhanced debugging (Docker Desktop 4.27+)
docker debug <container>

# Inspect container configuration
docker inspect <container>

# Check network configuration
docker network inspect <network>

Phase 4: Deep Analysis (15+ minutes)

Comprehensive investigation for complex issues.

# Monitor resource usage
docker stats <container>

# Check disk usage
docker system df -v

# Inspect image layers
docker history <image>

# Export container filesystem for analysis
docker export <container> -o container.tar

# View detailed container info
docker inspect <container> | jq '.'

Common Error Patterns and Solutions

Exit Codes

Exit CodeMeaningCommon CausesSolution
0SuccessNormal terminationNo action needed
1General errorApplication error, missing fileCheck logs, verify files exist
126Permission problemCannot execute commandCheck file permissions, add execute bit
127Command not foundMissing binary or PATH issueVerify command exists in image
137SIGKILL (OOM)Out of memoryIncrease memory limit, optimize app
139SIGSEGVSegmentation faultDebug application code
143SIGTERMGraceful shutdownNormal behavior during stop
255Exit status out of rangeVariousCheck application error handling

OOM Killed Containers (Exit Code 137)

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

# View memory limits
docker inspect <container> --format='{{.HostConfig.Memory}}'

# Run with increased memory
docker run -m 2g --memory-swap 4g <image>

# Monitor memory in real-time
docker stats --format "table {{.Name}}\t{{.MemUsage}}\t{{.MemPerc}}"

Image Build Failures

# Build with verbose output
docker build --progress=plain -t <image> .

# Build without cache
docker build --no-cache -t <image> .

# Build specific stage for debugging
docker build --target <stage-name> -t <image> .

# Inspect build cache
docker builder prune --dry-run

# Debug failed layer by running from previous successful layer
docker run -it <last-successful-layer-id> /bin/sh

Common Build Issues:

  • COPY failed: file not found - Check paths are relative to build context
  • RUN failed - Check command syntax, ensure dependencies are installed
  • Permission denied - Add chmod or run as appropriate user

Networking Issues

# List networks
docker network ls

# Inspect network
docker network inspect <network>

# Check container network settings
docker inspect <container> --format='{{json .NetworkSettings.Networks}}'

# Test connectivity between containers
docker exec <container1> ping <container2>

# Test DNS resolution
docker exec <container> nslookup <hostname>

# Check exposed ports
docker port <container>

# Debug with network tools
docker run --rm --network=<network> nicolaka/netshoot ping <target>

Common Network Issues:

  • Containers on different networks cannot communicate
  • Port already in use: lsof -i:<port> to find conflicting process
  • DNS resolution fails: Check Docker DNS settings

Volume Mount Problems

# List volumes
docker volume ls

# Inspect volume
docker volume inspect <volume>

# Check mount points
docker inspect <container> --format='{{json .Mounts}}'

# Verify host path exists
ls -la /path/to/host/directory

# Check permissions inside container
docker exec <container> ls -la /mount/path

# Test with simple container
docker run --rm -v /host/path:/container/path alpine ls -la /container/path

Common Volume Issues:

  • Permission denied - Check UID/GID mapping, use :z or :Z for SELinux
  • Path not found - Ensure host path exists before mounting
  • Windows paths - Use forward slashes or escaped backslashes

Permission Denied Errors

# Add user to docker group (Linux)
sudo usermod -aG docker $USER
newgrp docker

# Check Docker socket permissions
ls -la /var/run/docker.sock

# Run container as specific user
docker run --user $(id -u):$(id -g) <image>

# Fix file permissions in Dockerfile
RUN chown -R appuser:appuser /app
USER appuser

Container Exits Immediately

# Check what command is running
docker inspect <container> --format='{{.Config.Cmd}}'
docker inspect <container> --format='{{.Config.Entrypoint}}'

# Keep container running for debugging
docker run -d <image> tail -f /dev/null
# or
docker run -d <image> sleep infinity

# Override entrypoint for debugging
docker run -it --entrypoint /bin/sh <image>

# Check if process is foreground
# (Docker needs a foreground process to keep running)

Docker Desktop Won't Start

Windows:

  • Enable Hyper-V: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
  • Enable WSL2: wsl --install
  • Check virtualization in BIOS (VT-x/AMD-V)
  • Temporarily disable antivirus

Mac:

  • Check available disk space
  • Reset Docker Desktop: Delete ~/Library/Group\ Containers/group.com.docker/
  • Reinstall Docker Desktop

Linux:

  • Check Docker daemon: sudo systemctl status docker
  • View daemon logs: journalctl -u docker.service

Debugging Tools Reference

Essential Commands

# Container lifecycle
docker ps -a                          # List all containers
docker logs <container>               # View logs
docker logs -f --tail 100 <container> # Follow last 100 lines
docker exec -it <container> sh        # Interactive shell
docker inspect <container>            # Full container details
docker top <container>                # Running processes

# Images
docker images                         # List images
docker history <image>                # Show image layers
docker inspect <image>                # Image details

# System
docker system df                      # Disk usage
docker system events                  # Real-time events
docker system info                    # System-wide info
docker system prune                   # Clean up unused resources

# Network
docker network ls                     # List networks
docker network inspect <network>      # Network details

# Volumes
docker volume ls                      # List volumes
docker volume inspect <volume>        # Volume details

Advanced Debugging

# Docker debug (Docker Desktop 4.27+)
docker debug <container>              # Enhanced shell with tools

# Process inspection
docker exec <container> ps aux        # List processes
docker exec <container> top           # Interactive process viewer

# Network debugging
docker exec <container> netstat -tlnp # Open ports
docker exec <container> ss -tlnp      # Socket statistics
docker exec <container> curl -v <url> # HTTP debugging

# File system
docker diff <container>               # Changed files
docker cp <container>:/path ./local   # Copy files out
docker cp ./local <container>:/path   # Copy files in

# Resource monitoring
docker stats                          # Live resource usage
docker stats --no-stream              # Single snapshot

Debug Container Image

For minimal images without debugging tools, use a sidecar approach:

# Use netshoot for network debugging
docker run -it --network container:<target> nicolaka/netshoot

# Use busybox for basic tools
docker run -it --pid container:<target> busybox

Quick Reference Commands

# Most common debugging sequence
docker ps -a                                  # 1. Check status
docker logs --tail 100 -f <container>         # 2. View logs
docker exec -it <container> sh                # 3. Interactive shell
docker inspect <container>                    # 4. Full details

# Performance debugging
docker stats                                  # Resource usage
docker system df                              # Disk usage
docker events                                 # System events

# Network debugging
docker network ls                             # List networks
docker network inspect <network>              # Network details
docker exec <container> ping <host>           # Test connectivity

# Clean up
docker system prune -af                       # Remove all unused data
docker volume prune                           # Remove unused volumes
docker builder prune                          # Remove build cache

Troubleshooting Checklist

  • Check container status with docker ps -a
  • Review logs with docker logs <container>
  • Verify exit code with docker inspect --format='{{.State.ExitCode}}'
  • Check for OOM: docker inspect --format='{{.State.OOMKilled}}'
  • Verify network connectivity between containers
  • Check volume mounts and permissions
  • Ensure required ports are not in use
  • Verify environment variables are set correctly
  • Check available disk space with docker system df
  • Review Docker daemon logs if system-level issue

Sources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

29.75%
按下载量换算92

Claude Code

20.97%
按下载量换算65

Antigravity

19.58%
按下载量换算61

windsurf

13.65%
按下载量换算42

Codex

8.06%
按下载量换算25

Gemini CLI

3.86%
按下载量换算12

安全审计

暂无安全审计结果可展示。

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills