Docker Compose file · Volumes and networks

Use a named volume

Persist data in a volume managed by Docker.

services:
  db:
    volumes:
      - pgdata:/var/lib/postgresql
volumes:
  pgdata:

Official Docker Compose file documentation

More volumes and networks commands

All volumes and networks commands · Docker Compose file cheatsheet

Was this page helpful?