Docker调试与管理技能Skill docker-debugging

该技能用于 Docker 容器的调试、故障排除、日志分析、资源监控和管理,包括 Docker Compose 服务的操作。适用于 DevOps 工程师和系统管理员进行容器化应用的维护和优化。关键词:Docker 调试、容器管理、日志查看、资源监控、故障排除、DevOps、系统运维。

Docker/K8s 0 次安装 0 次浏览 更新于 3/16/2026

名称: docker-debugging 描述: Docker 容器调试和管理。用于调查容器问题、检查日志、资源使用情况或 Docker Compose 服务。 允许的工具: Bash(python *)

Docker 调试

身份验证

Docker 命令通过 Docker CLI 直接运行。不需要 API 密钥 - 必须在沙箱环境中访问 Docker 套接字。


可用脚本

所有脚本位于 .claude/skills/infrastructure-docker/scripts/

container_ps.py - 列出容器

python .claude/skills/infrastructure-docker/scripts/container_ps.py [--all]

container_logs.py - 获取容器日志

python .claude/skills/infrastructure-docker/scripts/container_logs.py --container NAME_OR_ID [--tail 100]

container_inspect.py - 检查容器

python .claude/skills/infrastructure-docker/scripts/container_inspect.py --container NAME_OR_ID

container_stats.py - 资源使用统计

python .claude/skills/infrastructure-docker/scripts/container_stats.py [--container NAME_OR_ID]

image_list.py - 列出 Docker 镜像

python .claude/skills/infrastructure-docker/scripts/image_list.py [--filter "reference=myapp*"]

compose_ps.py - 列出 Compose 服务

python .claude/skills/infrastructure-docker/scripts/compose_ps.py [--file docker-compose.yml] [--cwd /path]

compose_logs.py - 获取 Compose 服务日志

python .claude/skills/infrastructure-docker/scripts/compose_logs.py [--services "api,db"] [--tail 100]

调查工作流程

容器调试

1. 列出容器: container_ps.py --all
2. 检查日志: container_logs.py --container <名称> --tail 200
3. 检查资源: container_stats.py --container <名称>
4. 检查配置: container_inspect.py --container <名称>

Docker Compose 调试

1. 检查服务: compose_ps.py
2. 检查日志: compose_logs.py --services "api,worker" --tail 100

要避免的反模式

  1. 永远不要在没有明确用户批准的情况下运行破坏性命令 (docker rm, docker rmi, docker system prune)
  2. 始终使用 --tail 查看日志以避免输出过多
  3. 首先检查容器状态 在尝试执行进入之前