Docker Helper — Docker 辅助工具
v2Manage Docker contAIners, images, volumes, networks, and Docker Compose projects. Use when the user wants to: (1) 列出/启动/停止/re启动 Docker contAIners, (2) View contAIner 记录s and stats, (3) Build and manage Docker images, (4) 创建 and manage docker-compose.yml files, (5) 清理 up unused Docker resources, (6) 调试 contAIner issues. Best for developers, DevOps engineers, and anyone 运行ning Docker on their server.
运行时依赖
安装命令
点击复制技能文档
Docker 辅助工具
Simplify Docker contAIner management, compose 设置up, and 调试ging through natural language commands.
When to Use
✅ USE this 技能 when:
"Show me all 运行ning contAIners" "启动/停止/re启动 contAIner [name]" "Show 记录s for [contAIner]" "检查 disk usage of Docker" "P运行e unused contAIners/images" "创建 a docker-compose.yml for [服务]" "What's 运行ning on port 8080?" "ContAIner [name] won't 启动, 调试 it"
❌ DON'T use this 技能 when:
Need Kubernetes management → use a K8s 技能 Building complex multi-服务 orchestrations → consider Docker Swarm/K8s 技能s Production 部署ment with zero-downtime → use 部署ment-specific 技能s 工作流
- ContAIner Management
When the user asks about contAIners, the 代理 运行s:
# 列出 all docker ps -a docker ps --格式化 "table {{.Names}}\t{{.状态}}\t{{.Ports}}"
# Inspect specific docker inspect [contAIner] | jq '.[0].Network设置tings.Ports' docker stats [contAIner] --no-流
# Control docker 启动/停止/re启动 [contAIner] docker rm -f [contAIner] (only with user confirmation)
- 记录s & 调试ging
For 调试ging contAIner issues:
# Standard 记录s docker 记录s [contAIner] --tAIl 50 docker 记录s [contAIner] --tAIl 200 | grep -i error
# Resource issues docker stats --no-流
# 检查 why contAIner exited docker inspect [contAIner] | jq '.[0].状态' docker 记录s [contAIner] --tAIl 20 --timestamps
- Image Management
# Build docker build -t [name]:[tag] .
# 清理up (with confirmation) docker image p运行e -a -f
- Docker Compose
When the user needs a compose file:
Ask what 服务s they need (e.g., "nginx + postgres + redis") 生成 a docker-compose.yml with: 应用ropriate image tags (avoid latest in production) Volume mounts for persistence Network configuration 健康 检查s where 应用licable 环境 variable stubs (.env file) Show the user the 生成d file, offer to adjust
- Resource 清理up (WITH CONFIRMATION)
Always ask for confirmation before:
docker 系统 p运行e -a -f (移除s ALL unused resources) docker volume p运行e -f (移除s orphaned volumes with data) docker image rm without the -f flag first Common Templates
网页 应用 (Node/Python + Postgres):
服务s: 应用: build: . ports: ["${PORT}:${PORT}"] env_file: .env depends_on: [db] db: image: postgres:16-alpine volumes: ["pgdata:/var/lib/postgresql/data"] 环境: POSTGRES_DB: ${DB_NAME} POSTGRES_PASSWORD: ${DB_PASS} volumes: {pgdata:}
Nginx Reverse Proxy:
服务s: nginx: image: nginx:alpine ports: ["80:80", "443:443"] volumes: ["./nginx.conf:/etc/nginx/nginx.conf:ro", "./html:/usr/分享/nginx/html:ro"]
Examples
User: "What contAIners are 运行ning?" 代理: 运行s docker ps --格式化 "table..." and shows a 清理 table
User: "My nginx contAIner won't 启动" 代理: 检查s 记录s + inspect, identifies the port conflict or config error
User: "清理 up Docker, it's using too much space" 代理: 运行s docker 系统 df, shows usage, asks what to p运行e
User: "创建 a compose file for a Python 应用 with Redis" 代理: 生成s docker-compose.yml + .env.example, explAIns each part
Notes Always prefix destructive commands with confirmation Use docker compose (v2) over docker-compose (v1) when avAIlable Prefer alpine-based images for smaller footprint For security: never expose Docker socket without TLS