Docker Compose Generator for Multi-Service Apps
Added Apr 2, 2026
About This Prompt
This prompt generates Docker Compose configurations that follow production best practices out of the box, saving you from the hours of trial-and-error that typically accompany multi-service setups. Every service gets health checks, resource limits, and proper networking — the details that are easy to skip but critical for reliability. The companion .env.example and .dockerignore files mean your team can clone and run without configuration archaeology. The security audit catches common mistakes like exposed ports and root containers before they reach production. Whether you are setting up a local development environment or deploying to a Docker Compose-based production setup, this prompt produces configurations that work correctly the first time.
Variables to Customize
[APP_TYPE]
The type of application being containerized
Example: full-stack SaaS application
[SERVICES_LIST]
The services that need to run together
Example: Next.js frontend, Node.js API, PostgreSQL database, Redis cache, Nginx reverse proxy, and Celery worker with RabbitMQ
[ENVIRONMENT]
Where this will be deployed
Example: local development with hot-reloading, with a separate production override file
Tips for Best Results
- Specify your exact technology versions so Cursor pins the right image tags
- Ask for a docker-compose.override.yml for development-specific settings like volume mounts and debug ports
- Include your current Dockerfile if you have one so Cursor can optimize it alongside the compose config
Example Output
```yaml
# docker-compose.yml
# Full-stack SaaS application - Development Configuration
# Compose Specification v3.8
version: '3.8'
services:
# --- Application Layer ---
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: development
ports:
- "3000:3000"
volumes:
- ./frontend/src:/app/src # Hot-reload source files
environment:
- NEXT_PUBLIC_API_URL=http://localhost:4000
depends_on:
api:
condition: service_healthy
networks:
- frontend-net
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
api:
build:
context: ./api
dockerfile: Dockerfile
# ... continued
```