Difference between revisions of "Docker-compose: volumes:"
Jump to navigation
Jump to search
↑ https://docs.docker.com/compose/compose-file/#volumes
Line 3: | Line 3: | ||
== 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 |
Revision as of 14:30, 17 April 2021
Docker compose file: docker-compose.yml (examples)
volumes: [1]
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
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
See also
docker-compose
,docker-compose.yml
: [services
|volumes
|networks
|up
|down
|restart
|logs
|create
|changelog
|version
|secrets
|config
|-v
|-h
|exec], docker-compose pull
,Environment:
, Docker-compose.yml examples,.env
, release notes, expose:, docker-compose --env-file,services.deploy.resources
- Docker Volumes:
docker volume ls
,docker volume create
,docker volume inspect
,docker volumes prune
,docker volume create
,docker volume rm
,docker system df
,mounts
,--volumes-from
Advertising: