docker-compose
БесплатноБез исполняемых скриптовНе проверенDocker Compose for multi-container apps. Covers services, networks, and volumes. Use for local development environments. USE WHEN: user mentions…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Docker Compose Core Knowledge
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:docker-composefor 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
dockerskill - Deploying to production Kubernetes clusters - use
kubernetesskill - Setting up CI/CD workflows - use
github-actionsskill - Working with Docker Swarm (deprecated) - use
kubernetesskill - Building Docker images only (no orchestration needed) - use
dockerskill
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Hardcoding ports in compose | Port conflicts, inflexible | Use ${PORT:-3000}:3000 with env vars |
| No health checks | Services start before ready | Add healthcheck and depends_on.condition |
| Exposing all ports publicly | Security risk | Bind to 127.0.0.1:port for local only |
Using latest tags |
Unpredictable behavior | Pin specific versions postgres:16-alpine |
| Storing secrets in compose file | Secret exposure | Use Docker secrets or env files (gitignored) |
| No resource limits | Resource exhaustion | Set deploy.resources.limits |
| Mixing dev and prod config | Configuration drift | Use docker-compose.override.yml and .prod.yml |
| Not using named volumes | Data loss on recreation | Use named volumes for persistence |
| Services on default network | No isolation | Create custom networks per tier |
| Running as root | Security vulnerability | Set user: "1000:1000" or use Dockerfile USER |
Quick Troubleshooting
| Issue | Diagnosis | Fix |
|---|---|---|
| Service won't start | Dependency not ready | Add depends_on with condition: service_healthy |
| Port already in use | Another service using port | Change port mapping or stop conflicting service |
| Database connection refused | Service name wrong, network issue | Use service name as host: db:5432 not localhost |
| Changes not reflected | Old containers running | Run docker-compose down && docker-compose up --build |
| Volume data not persisting | Using anonymous volumes | Use named volumes in top-level volumes: |
| "network not found" | Network removed or wrong name | Run docker-compose up to recreate networks |
| Can't connect between services | Different networks | Put services on same network |
| Environment variables not working | Wrong syntax, not loaded | Use ${VAR:-default} and check .env file |
| "service unhealthy" | Health check failing | Check docker-compose logs and fix health endpoint |
| Slow startup on Mac/Windows | Volume mounting overhead | Use 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_pass
Установить docker-compose в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditВложенные файлы
FAQ
Что делает скилл docker-compose?
Docker Compose for multi-container apps. Covers services, networks, and volumes. Use for local development environments. USE WHEN: user mentions "docker-compose", "docker-compose.yml", "multi-container", "service dependencies", "docker compose up", asks about "local dev environment", "microservices setup", "database + app setup", "docker networks", "docker volumes" DO NOT USE FOR: single container Dockerfiles - use `docker` skill instead, production orchestration - use `kubernetes` skill instead, CI/CD pipelines - use `github-actions` skill instead
Как установить скилл docker-compose?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker-compose запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub