Docker Compose concept
Docker Compose runs several containers together from one file, like your app plus a database. One command starts everything with the right settings and connections.
# docker-compose.yml
services:
app:
build: .
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://postgres:secret@db:5432/app
depends_on:
- db
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secret
POSTGRES_DB: app
docker compose up -d # start everything
docker compose down # stop everything