Docker Compose (Multi-Container Setup)
For production environments, you can split services into multiple containers — typically App, Database, and Reverse Proxy (Nginx/Apache).
Typical Directory Structure
├── db/
└── nginx/
/yourOraganization/
├── docker-compose.yml
├── app/
├── db/
└── nginx/
Sample docker-compose.yml
services:
app:
image: yourorganization:latest
ports:
– “8080:80”
depends_on:
– db
environment:
– DB_HOST=db
– DB_USER=root
– DB_PASS=password
volumes:
– ./app/uploads:/var/www/html/app/webroot/uploads
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: database
volumes:
– ./db/data:/var/lib/mysql
nginx:
image: nginx:latest
ports:
– “80:80”
– “443:443”
volumes:
– ./nginx/conf:/etc/nginx/conf.d
Launch Stack
docker-compose up -d
Verify Services
docker ps
Best For: Mid to large teams needing modular scaling, independent updates, and separate storage volumes.