Tool for defining and running multi-container applications with a YAML file, simplifying local development of systems with multiple services.
Docker Compose is a tool for defining and running applications consisting of multiple Docker containers. A compose.yaml file describes all services, networks, and volumes, and a single command brings them all up.
services:
web:
build: .
ports:
- "3000:3000"
depends_on:
- db
environment:
DATABASE_URL: postgres://db:5432/app
db:
image: postgres:16
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: app
volumes:
pgdata:docker compose up: bring up all servicesdocker compose up -d: bring up in backgrounddocker compose down: stop and remove containersdocker compose logs -f: follow logs from all servicesdocker compose exec web sh: shell into a service| Aspect | Docker Compose | Kubernetes |
|---|---|---|
| Purpose | Local development, CI | Production, orchestration at scale |
| Complexity | Low — one YAML file | High — multiple resources (Deployments, Services, Ingress) |
| Scaling | Manual (scale: 3) | Automatic (HPA, VPA) |
| Networking | Default bridge network | CNI plugins, service discovery |
| State | Stateful with local volumes | StatefulSets, PersistentVolumes |
| Migration | — | Kompose converts compose files to K8s manifests |
Docker Compose allows defining multi-container applications as code. For local development, it replaces complex setup scripts with a single command that starts databases, caches, and auxiliary services in the correct order.
Container platform that packages applications with all dependencies into portable, consistent units that run identically in any environment.
Practices and tools for creating productive development environments on the developer's machine, replicating production as closely as possible.