docker-debugging
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDocker Debugging
Docker容器调试
Authentication
身份验证
Docker commands run directly via the Docker CLI. No API keys are needed - the Docker socket must be accessible in the sandbox environment.
Docker命令通过Docker CLI直接运行。无需API密钥——沙箱环境中必须能够访问Docker socket。
Available Scripts
可用脚本
All scripts are in
.claude/skills/infrastructure-docker/scripts/所有脚本均位于 目录下
.claude/skills/infrastructure-docker/scripts/container_ps.py - List Containers
container_ps.py - 列出容器
bash
python .claude/skills/infrastructure-docker/scripts/container_ps.py [--all]bash
python .claude/skills/infrastructure-docker/scripts/container_ps.py [--all]container_logs.py - Get Container Logs
container_logs.py - 获取容器日志
bash
python .claude/skills/infrastructure-docker/scripts/container_logs.py --container NAME_OR_ID [--tail 100]bash
python .claude/skills/infrastructure-docker/scripts/container_logs.py --container NAME_OR_ID [--tail 100]container_inspect.py - Inspect Container
container_inspect.py - 检查容器详情
bash
python .claude/skills/infrastructure-docker/scripts/container_inspect.py --container NAME_OR_IDbash
python .claude/skills/infrastructure-docker/scripts/container_inspect.py --container NAME_OR_IDcontainer_stats.py - Resource Usage Statistics
container_stats.py - 资源使用统计
bash
python .claude/skills/infrastructure-docker/scripts/container_stats.py [--container NAME_OR_ID]bash
python .claude/skills/infrastructure-docker/scripts/container_stats.py [--container NAME_OR_ID]image_list.py - List Docker Images
image_list.py - 列出Docker镜像
bash
python .claude/skills/infrastructure-docker/scripts/image_list.py [--filter "reference=myapp*"]bash
python .claude/skills/infrastructure-docker/scripts/image_list.py [--filter "reference=myapp*"]compose_ps.py - List Compose Services
compose_ps.py - 列出Compose服务
bash
python .claude/skills/infrastructure-docker/scripts/compose_ps.py [--file docker-compose.yml] [--cwd /path]bash
python .claude/skills/infrastructure-docker/scripts/compose_ps.py [--file docker-compose.yml] [--cwd /path]compose_logs.py - Get Compose Service Logs
compose_logs.py - 获取Compose服务日志
bash
python .claude/skills/infrastructure-docker/scripts/compose_logs.py [--services "api,db"] [--tail 100]bash
python .claude/skills/infrastructure-docker/scripts/compose_logs.py [--services "api,db"] [--tail 100]Investigation Workflow
排查工作流
Container Debugging
容器调试
1. List containers: container_ps.py --all
2. Check logs: container_logs.py --container <name> --tail 200
3. Check resources: container_stats.py --container <name>
4. Inspect config: container_inspect.py --container <name>1. 列出容器:container_ps.py --all
2. 查看日志:container_logs.py --container <name> --tail 200
3. 检查资源:container_stats.py --container <name>
4. 查看配置详情:container_inspect.py --container <name>Docker Compose Debugging
Docker Compose调试
1. Check services: compose_ps.py
2. Check logs: compose_logs.py --services "api,worker" --tail 1001. 检查服务:compose_ps.py
2. 查看日志:compose_logs.py --services "api,worker" --tail 100Anti-Patterns to Avoid
需避免的反模式
- Never run destructive commands without explicit user approval (docker rm, docker rmi, docker system prune)
- Always use --tail for logs to avoid overwhelming output
- Check container status first before trying to exec into it
- 未经用户明确批准,切勿执行破坏性命令(docker rm、docker rmi、docker system prune)
- 查看日志时务必使用--tail参数,避免输出内容过多
- 在尝试进入容器执行命令前,务必先检查容器状态