Zest.

Docker: docker compose example

A short, tested Docker example for docker compose example. Copy it and adjust the names and paths for your project.

Docker
services:
  web:
    build: .
    ports: ["3000:3000"]
    environment:
      DATABASE_URL: postgres://app:secret@db:5432/app
    depends_on: [db]
  db:
    image: postgres:17
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: secret
    volumes: [pgdata:/var/lib/postgresql/data]
volumes:
  pgdata:

Find it in Zest

Search for “docker docker compose example” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More Docker examples

All Docker examples