Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
articles:linux:docker-reference-page [2022/02/12 16:07] tom [Docker Volumes] |
articles:linux:docker-reference-page [2022/02/12 16:32] (current) tom [Packaging & Distributing Your Own Docker Containers into Images] |
||
---|---|---|---|
Line 87: | Line 87: | ||
ports: | ports: | ||
- [host port]: | - [host port]: | ||
+ | volumes: | ||
+ | - [user reference name]: | ||
+ | - [host path]: | ||
+ | - [container path] {for an anonymous volume} | ||
environment: | environment: | ||
- [environment setting]=[assigned value] | - [environment setting]=[assigned value] | ||
Line 93: | Line 97: | ||
ports: | ports: | ||
- [host port]: | - [host port]: | ||
+ | volumes: | ||
+ | - [user reference name]: | ||
+ | - [host path]: | ||
+ | - [container path] {for an anonymous volume} | ||
environment: | environment: | ||
- [environment setting]=[assigned value] | - [environment setting]=[assigned value] | ||
+ | |||
+ | # For two containers to share a volume, you can set that after defining named volumes above and adding the volume after the container definition and using an already defined name (i.e). | ||
+ | |||
+ | volumes: | ||
+ | db-data: {assuming db-data was established above} | ||
+ | driver: local {this is needed but not sure why} | ||
+ | |||
</ | </ | ||
Line 127: | Line 142: | ||
docker run -v / | docker run -v / | ||
- | # An anonymous volume (Note: I am only showing the -v flag and I don't necessarily know where the persistent storage is kept). | + | # An anonymous volume (Note: I am only showing the -v flag and I don't necessarily know where the persistent storage is kept but should be below / |
docker run -v [container folder] | docker run -v [container folder] | ||
docker run -v / | docker run -v / | ||
- | # A named volume (Note: I am only showing the -v flag, again I may not know where the storage is kept, but I am able to reference it better than an anonymous volume). | + | # A named volume (Note: I am only showing the -v flag, again I may not know where the storage is kept but should be below / |
</ | </ | ||
Line 140: | Line 155: | ||
{{youtube> | {{youtube> | ||
- | |||
- | |||
- | |||
- | |||
- | https:// | ||
- | https:// |