Difference between revisions of "Docker-compose: volumes:"

From wikieduonline
Jump to navigation Jump to search
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
* https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
 +
 
[[Docker compose file: docker-compose.yml]] ([[Docker-compose.yml examples|examples]])
 
[[Docker compose file: docker-compose.yml]] ([[Docker-compose.yml examples|examples]])
 
  [[docker-compose: volumes|volumes]]: <ref>https://docs.docker.com/compose/compose-file/#volumes</ref>
 
  [[docker-compose: volumes|volumes]]: <ref>https://docs.docker.com/compose/compose-file/#volumes</ref>
 +
 +
https://docs.docker.com/storage/storagedriver/select-storage-driver/
 +
[[overlay2]], [[fuse-overlayfs]], [[btrfs]], [[zfs]], [[vfs]], [[aufs]], [[devicemapper]], [[overlay]]
  
 
== Examples ==
 
== Examples ==
 +
 +
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
 
https://docs.docker.com/compose/compose-file/#volumes#driver_opts
Line 8: Line 29:
 
   example:
 
   example:
 
     driver_opts:
 
     driver_opts:
       type: "nfs"
+
       type: "[[nfs]]"
 
       o: "addr=10.40.0.199,nolock,soft,rw"
 
       o: "addr=10.40.0.199,nolock,soft,rw"
 
       device: ":/docker/example"
 
       device: ":/docker/example"
Line 20: Line 41:
 
https://docs.docker.com/compose/compose-file/#volumes#driver_opts
 
https://docs.docker.com/compose/compose-file/#volumes#driver_opts
 
  volumes:
 
  volumes:
   [[grafana]]_storage:
+
   [[Docker-compose.yml (Grafana)|grafana]]_storage:
           driver: local
+
           [[driver:]] local
 +
 
 +
 
 +
== Related ==
 +
* [[docker system df]]
 +
* [[expose]] [[ports]]
  
 
== See also ==
 
== See also ==

Latest revision as of 09:27, 21 April 2024

Docker compose file: docker-compose.yml (examples)

volumes: [1]
https://docs.docker.com/storage/storagedriver/select-storage-driver/
overlay2, fuse-overlayfs, btrfs, zfs, vfs, aufs, devicemapper, overlay

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]

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