Cheatsheet Pages / Docker Cheatsheet

Sample compose.yaml — a web service with a Postgres database

You want a realistic starting point: an app service wired to a database with persistent storage.

services:
  web:
    build: .
    ports: ["3000:3000"]
    depends_on: [db]
  db:
    image: postgres:16
    environment: {POSTGRES_PASSWORD: example}
    volumes: [pgdata:/var/lib/postgresql/data]
volumes: {pgdata:}
Docker Cheatsheet one-page card — commands that actually work
The full one-page card — Docker Cheatsheet. Get the complete cheatsheet on GitHub