Created
January 11, 2025 21:08
-
-
Save shmup/d7e071927e6b740b6191b381d1120d87 to your computer and use it in GitHub Desktop.
volume mounts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple bind mount - directly maps host directory to container | |
# pro: simple, direct | |
# con: less docker-native management | |
volumes: | |
- /opt/medusa/postgres:/var/lib/postgresql/data | |
# named volume with bind properties - docker managed but host-accessible | |
# pro: docker volume features (named reference, metadata, drivers) | |
# con: more verbose, possibly overengineered for simple needs | |
volumes: | |
postgres_data: | |
driver: local | |
driver_opts: | |
type: none # disables storage driver features | |
o: bind # makes it act like bind mount | |
device: /opt/medusa/postgres # host path | |
# relative path bind mount - maps directory relative to docker-compose.yml | |
# pro: portable across machines, stays with project | |
# con: must run docker-compose from correct directory | |
volumes: | |
- ./postgres:/var/lib/postgresql/data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment