← Back to all products
$19
Docker Compose Templates
Production-ready Docker Compose configurations for the most common web stacks.
MarkdownYAMLConfigDockerDjangoFlaskRedisPostgreSQLMongoDBNginx
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 14 files
docker-compose-templates/
├── LICENSE
├── README.md
├── examples/
│ └── env.example
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_configuration.md
│ └── 04_faq.md
├── index.html
└── src/
├── docker-compose-django.yml
├── docker-compose-flask.yml
├── docker-compose-lamp.yml
├── docker-compose-mean.yml
└── docker-compose-rails.yml
📖 Documentation Preview README excerpt
Docker Compose Templates
Production-ready Docker Compose configurations for the most common web stacks. Copy, customize, and docker-compose up.
Features
- LAMP stack — Apache, MySQL 8, PHP 8.2 with phpMyAdmin
- MEAN stack — MongoDB, Express, Angular (served via Nginx), Node.js
- Django stack — Python 3.12, Django, PostgreSQL, Redis, Nginx
- Flask stack — Python 3.12, Flask, PostgreSQL, Redis, Celery
- Rails stack — Ruby 3.3, Rails 7, PostgreSQL, Redis, Sidekiq
- Health checks on all services for reliable startup ordering
- Named volumes for persistent data across restarts
- Environment files for secrets and configuration
- Production-ready defaults with sensible resource limits
Requirements
- Docker 24+ and Docker Compose V2
- No Python or other runtime dependencies
Quick Start
# Pick a stack and start it
cd src/
docker compose -f docker-compose-django.yml up -d
# Check running services
docker compose -f docker-compose-django.yml ps
# View logs
docker compose -f docker-compose-django.yml logs -f
# Tear down
docker compose -f docker-compose-django.yml down -v
Included Stacks
| File | Stack | Services | Ports |
|---|---|---|---|
docker-compose-lamp.yml | LAMP | Apache, PHP 8.2, MySQL 8, phpMyAdmin | 80, 8080 |
docker-compose-mean.yml | MEAN | Node.js, MongoDB, Nginx | 80, 3000 |
docker-compose-django.yml | Django | Python, Django, PostgreSQL, Redis, Nginx | 80, 8000 |
docker-compose-flask.yml | Flask | Python, Flask, PostgreSQL, Redis, Celery | 80, 5000 |
docker-compose-rails.yml | Rails | Ruby, Rails, PostgreSQL, Redis, Sidekiq | 80, 3000 |
Configuration
Each stack uses an .env file for configuration. See examples/ for sample env files.
| Variable | Default | Description |
|---|---|---|
DB_NAME | app_db | Database name |
DB_USER | app_user | Database user |
DB_PASSWORD | changeme_in_production | Database password |
DB_PORT | varies | Database port |
REDIS_URL | redis://redis:6379/0 | Redis connection URL |
APP_ENV | development | Application environment |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .yml preview
src/docker-compose-django.yml
# ============================================================
# Docker Compose — Django Stack
# Deploy Kit (CodeVault)
#
# Full Django development and production stack:
# - Python 3.12 + Django via Gunicorn
# - PostgreSQL 16 for the database
# - Redis for caching and Celery broker
# - Nginx as reverse proxy
# - Celery worker for async tasks
#
# Usage:
# cp ../examples/env.django .env
# docker compose -f docker-compose-django.yml up -d
#
# IMPORTANT: Change ALL default passwords before deploying
# to any environment beyond localhost.
# ============================================================
services:
# -----------------------------------------------------------
# PostgreSQL 16 — Primary database
# Why Postgres: Battle-tested, great Django support, rich
# ecosystem of extensions (PostGIS, pg_trgm, etc.)
# -----------------------------------------------------------
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-app_db}
POSTGRES_USER: ${DB_USER:-app_user}
# SECURITY: Change this password before deploying anywhere
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme_in_production}
volumes:
# Named volume ensures data survives container restarts
- postgres_data:/var/lib/postgresql/data
ports:
# Expose to host for local dev tools (pgAdmin, DBeaver)
# Remove this port mapping in production
- "${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-app_user} -d ${DB_NAME:-app_db}"]
interval: 10s
timeout: 5s
retries: 5
# Resource limits prevent runaway queries from killing the host
deploy:
resources:
limits:
memory: 512M
# ... 154 more lines ...