Docker-compose: volumes:

From wikieduonline
Revision as of 09:27, 21 April 2024 by Welcome (talk | contribs) (→‎Related)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Examples[edit]

https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference

version: "3.9"

services:
  db:
    image: db
    volumes:
      - my-data-volume:/var/lib/db
  backup:
    image: backup-service
    volumes:
      - my-data-volume:/var/lib/backup/data

volumes:
  my-data-volume:

https://docs.docker.com/compose/compose-file/#volumes#driver_opts

volumes:
 example:
   driver_opts:
     type: "nfs"
     o: "addr=10.40.0.199,nolock,soft,rw"
     device: ":/docker/example"

https://docs.docker.com/compose/compose-file/#volumes#external
If set to true, specifies that this volume has been created outside of Compose.

volumes:
 data:
   external: true

https://docs.docker.com/compose/compose-file/#volumes#driver_opts

volumes:
  grafana_storage:
         driver: local


Related[edit]

See also[edit]

Advertising: