Created
May 26, 2022 18:50
-
-
Save webgtx/dbe48641078cd06c32f922d8281d0111 to your computer and use it in GitHub Desktop.
docker volume control
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
# create the volume in advance | |
docker volume create --driver local \ | |
--opt type=none \ | |
--opt device=/home/user/test \ | |
--opt o=bind \ | |
test_vol | |
# create on the fly with --mount | |
docker run -it --rm \ | |
--mount type=volume,dst=/container/path,volume-driver=local,volume-opt=type=none,volume-opt=o=bind,volume-opt=device=/home/user/test \ | |
foo | |
# inside a docker-compose file | |
... | |
test: | |
... | |
volumes: | |
- bind-test:/var/lib/grafana |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment