Docker Compose defines and runs multi-container applications with a YAML file. One command builds, creates, and starts all services. See official Compose docs.
Last updated: April 2026
Compose is included with Docker Desktop. On Linux you may have the plugin or standalone binary.
docker compose versiondocker compose up -ddocker compose logs -fdocker compose downdocker compose configApp + Postgres with a named volume. Save as docker-compose.yml in your project and run docker compose up -d.
services:
app:
image: node:20-alpine
working_dir: /app
volumes:
- .:/app
ports:
- "3000:3000"
command: npm run dev
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: appdb
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
ComposeBot
AI-powered assistant