Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问许可证需确认审计通过

docker-composeDocker Compose 编排

Agent Skill

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

总安装

890

周安装

36

GitHub Stars

12

下载量

279
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill docker-compose

简介

用于编排多容器应用,支持服务依赖、网络和卷配置管理。

  • 可生成完整栈示例,包括数据库、缓存和开发热重载设置。
  • 提供健康检查与条件启动机制,确保服务按序初始化。
  • 部署前应验证 compose 文件语法,生产环境需限制调试端口暴露。
  • docker-compose 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Docker Compose Core Knowledge

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: docker-compose for comprehensive documentation.

Full Stack Example

# docker-compose.yml
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgresql://user:pass@db:5432/mydb
      - REDIS_URL=redis://redis:6379
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
    volumes:
      - ./src:/app/src  # Dev hot reload
    networks:
      - app-network

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: mydb
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user -d mydb"]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - app-network

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data
    networks:
      - app-network

volumes:
  postgres_data:
  redis_data:

networks:
  app-network:
    driver: bridge

Common Commands

# Start services
docker-compose up -d
docker-compose up --build  # Rebuild images

# Stop
docker-compose down
docker-compose down -v     # Remove volumes too

# Logs
docker-compose logs -f app
docker-compose logs --tail=100 app

# Execute
docker-compose exec app sh
docker-compose exec db psql -U user mydb

# Scale
docker-compose up -d --scale app=3

Override for Dev

# docker-compose.override.yml (auto-loaded)
services:
  app:
    build:
      target: development
    volumes:
      - .:/app
      - /app/node_modules
    command: npm run dev

Environment Files

services:
  app:
    env_file:
      - .env
      - .env.local

When NOT to Use This Skill

Skip this skill when:

  • Creating single-container Dockerfiles - use docker skill
  • Deploying to production Kubernetes clusters - use kubernetes skill
  • Setting up CI/CD workflows - use github-actions skill
  • Working with Docker Swarm (deprecated) - use kubernetes skill
  • Building Docker images only (no orchestration needed) - use docker skill

Anti-Patterns

Anti-PatternProblemSolution
Hardcoding ports in composePort conflicts, inflexibleUse ${PORT:-3000}:3000 with env vars
No health checksServices start before readyAdd healthcheck and depends_on.condition
Exposing all ports publiclySecurity riskBind to 127.0.0.1:port for local only
Using latest tagsUnpredictable behaviorPin specific versions postgres:16-alpine
Storing secrets in compose fileSecret exposureUse Docker secrets or env files (gitignored)
No resource limitsResource exhaustionSet deploy.resources.limits
Mixing dev and prod configConfiguration driftUse docker-compose.override.yml and .prod.yml
Not using named volumesData loss on recreationUse named volumes for persistence
Services on default networkNo isolationCreate custom networks per tier
Running as rootSecurity vulnerabilitySet user: "1000:1000" or use Dockerfile USER

Quick Troubleshooting

IssueDiagnosisFix
Service won't startDependency not readyAdd depends_on with condition: service_healthy
Port already in useAnother service using portChange port mapping or stop conflicting service
Database connection refusedService name wrong, network issueUse service name as host: db:5432 not localhost
Changes not reflectedOld containers runningRun docker-compose down && docker-compose up --build
Volume data not persistingUsing anonymous volumesUse named volumes in top-level volumes:
"network not found"Network removed or wrong nameRun docker-compose up to recreate networks
Can't connect between servicesDifferent networksPut services on same network
Environment variables not workingWrong syntax, not loadedUse ${VAR:-default} and check .env file
"service unhealthy"Health check failingCheck docker-compose logs and fix health endpoint
Slow startup on Mac/WindowsVolume mounting overheadUse named volumes instead of bind mounts for dependencies

Production Readiness

Security Configuration

# docker-compose.prod.yml
services:
  app:
    image: myapp:${VERSION:-latest}
    security_opt:
      - no-new-privileges:true
    read_only: true
    tmpfs:
      - /tmp
    cap_drop:
      - ALL
    cap_add:
      - NET_BIND_SERVICE
    user: "1000:1000"
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 2G
        reservations:
          cpus: '0.5'
          memory: 512M

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_PASSWORD_FILE: /run/secrets/db_password
    secrets:
      - db_password
    volumes:
      - postgres_data:/var/lib/postgresql/data:Z

secrets:
  db_password:
    file: ./secrets/db_password.txt

Health Checks

services:
  app:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

  db:
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 3

Networking

services:
  app:
    networks:
      - frontend
      - backend
    ports:
      - "127.0.0.1:3000:3000"  # Only localhost

  db:
    networks:
      - backend
    # No ports exposed externally

  nginx:
    networks:
      - frontend
    ports:
      - "80:80"
      - "443:443"

networks:
  frontend:
    driver: bridge
  backend:
    driver: bridge
    internal: true  # No internet access

Logging

services:
  app:
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"
        labels: "service,environment"
    labels:
      - "service=app"
      - "environment=production"

  # Or use external logging
  app:
    logging:
      driver: fluentd
      options:
        fluentd-address: localhost:24224
        tag: "docker.{{.Name}}"

Restart Policies

services:
  app:
    restart: unless-stopped
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s

  db:
    restart: always

Backup Strategy

services:
  backup:
    image: postgres:16-alpine
    entrypoint: /bin/sh
    command: -c "pg_dump -h db -U $$POSTGRES_USER $$POSTGRES_DB | gzip > /backups/backup_$$(date +%Y%m%d_%H%M%S).sql.gz"
    environment:
      PGPASSWORD_FILE: /run/secrets/db_password
    secrets:
      - db_password
    volumes:
      - ./backups:/backups
    depends_on:
      db:
        condition: service_healthy
    profiles:
      - backup

Testing

# docker-compose.test.yml
services:
  test:
    build:
      context: .
      target: test
    environment:
      - DATABASE_URL=postgresql://test:test@db-test:5432/testdb
    depends_on:
      db-test:
        condition: service_healthy
    command: npm test

  db-test:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: test
      POSTGRES_PASSWORD: test
      POSTGRES_DB: testdb
    tmpfs:
      - /var/lib/postgresql/data  # In-memory for speed
# Run tests
docker-compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from test

Monitoring Metrics

MetricTarget
Container uptime> 99.9%
Health check pass rate100%
Restart count< 1/day
Memory usage< 80% limit

Checklist

  • Security opts (no-new-privileges, read_only)
  • Resource limits (CPU, memory)
  • Health checks on all services
  • Internal networks for databases
  • Secrets management (not env vars)
  • Logging with rotation
  • Restart policies configured
  • Backup strategy defined
  • Test compose file
  • Production override file

Reference Documentation

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

展示第三方安全扫描或审计结果

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

平台分布

Codex

37.24%
按下载量换算104

Claude

30.45%
按下载量换算85

Cursor

18.13%
按下载量换算51

Gemini CLI

10.01%
按下载量换算28

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

来源信息

继续浏览同类 Skills