Docker Compose
Define and run multi-container Docker applications using Docker Compose.
Install
npx skills add BagelHole/DevOps-Security-Agent-Skills --skill docker-compose -g -a claude-code -y- Repository
- BagelHole/DevOps-Security-Agent-Skills1.2k
- Category
- DevOps
- Updated
- 6mo ago
- License
- MIT
- Context cost
- Mediumabout 1,935 tokens
- Runs scripts
- No, instructions only
What it does
Define and run multi-container Docker applications using Docker Compose. Create compose files, manage service dependencies, configure networks and volumes, and orchestrate local development environments. Use when setting up multi-service applications or development environments.
Docker Compose
Orchestrate multi-container applications with declarative YAML configuration.
When to Use This Skill
Use this skill when:
- Running multi-container applications locally
- Setting up development environments
- Defining service dependencies and networking
- Managing application stacks with multiple services
- Creating reproducible development setups
Prerequisites
- Docker Engine with Compose plugin (v2)
- Basic Docker knowledge
- YAML syntax understanding
Basic Configuration
Simple Application Stack
# docker-compose.yml
version: '3.8'
services:
web:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:secret@db:5432/myapp
depends_on:
- db
- redis
db:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
POSTGRES_DB: myapp
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres-data:
Service Configuration
Build Options
services:
app:
build:
context: ./app
dockerfile: Dockerfile.dev
args:
NODE_VERSION: "20"
target: development
cache_from:
- myapp:cache
image: myapp:dev
Environment Variables
services:
app:
environment:
- NODE_ENV=production
- API_KEY=${API_KEY} # From shell or .env file
env_file:
- .env
- .env.local
Port Mapping
services:
web:
ports:
- "3000:3000" # HOST:CONTAINER
- "127.0.0.1:9229:9229" # Bind to localhost only
- "8080-8090:8080-8090" # Port range
expose:
- "3000" # Internal only (no host binding)

