🦀 ClawHub
Docker Compose Optimizer
by @charlie-morrison
Optimize Docker Compose configurations for development and production — audit services, networking, volumes, health checks, and resource management.
TERMINAL
clawhub install docker-compose-optimizer📖 About This Skill
name: docker-compose-optimizer description: Optimize Docker Compose configurations for development and production — audit services, networking, volumes, health checks, and resource management. metadata: tags: ["docker-compose", "containers", "devops", "optimization", "development"]
Docker Compose Optimizer
Analyze Docker Compose files for best practices, security, performance, and production readiness. Audit service configurations, networking, volume mounts, health checks, dependency management, and resource constraints.
Usage
"Optimize my docker-compose.yml"
"Check Docker Compose for security issues"
"Review my multi-service setup"
"Make my Compose config production-ready"
How It Works
1. Configuration Analysis
cat docker-compose.yml 2>/dev/null || cat docker-compose.yaml 2>/dev/null || cat compose.yml 2>/dev/null
ls docker-compose*.yml 2>/dev/null
2. Service Audit
latest)unless-stopped for production).env file, not inline.dockerignore configured?3. Networking
4. Volumes & Storage
5. Dependencies & Ordering
depends_on with health check conditionsprofiles)6. Resource Management
mem_limit, memswap_limit)cpus, cpu_shares)7. Dev vs Production
docker-compose.override.yml for dev)Output
## Docker Compose AnalysisServices: 6 | Networks: 1 (default) | Volumes: 3
🔴 Issues (2)
1. No health checks — 4/6 services missing health checks
depends_on without condition: service_healthy is unreliable
→ Add healthcheck to db, redis, api, worker2. Secrets in compose file — DB password inline
POSTGRES_PASSWORD: mypassword123
→ Move to .env file or Docker secrets
🟡 Improvements (4)
3. No memory limits on any service — risk of one service OOM-killing others
4. Using latest tag on redis and postgres images
5. Default bridge network — create custom network for service isolation
6. No logging limits — logs will grow unbounded✅ Good Practices
Named volumes for database persistence
Restart policy set to unless-stopped
Build context uses multi-stage Dockerfile
Override file separates dev config
💡 Examples
"Optimize my docker-compose.yml"
"Check Docker Compose for security issues"
"Review my multi-service setup"
"Make my Compose config production-ready"