mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-09-01 13:22:38 +02:00
Add resource to docker volumes (#6410)
* Update 101-volume-mounts.md Add a link to help beginners understanding the subtle differences between `-v` and `--mount` flag. * Update src/data/roadmaps/docker/content/104-data-persistence/101-volume-mounts.md --------- Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
This commit is contained in:
@@ -34,6 +34,9 @@ docker run -d --mount source=my-volume,destination=/data your-image
|
|||||||
|
|
||||||
In both examples above, `my-volume` is the name of the volume we created earlier, and `/data` is the path inside the container where the volume will be mounted.
|
In both examples above, `my-volume` is the name of the volume we created earlier, and `/data` is the path inside the container where the volume will be mounted.
|
||||||
|
|
||||||
|
> For an in-depth exploration of the `-v` and `--mount` flags, consult Docker's official guide on [Choose the -v or --mount flag](https://docs.docker.com/storage/bind-mounts/#choose-the--v-or---mount-flag).
|
||||||
|
|
||||||
|
|
||||||
## Sharing Volumes Between Containers
|
## Sharing Volumes Between Containers
|
||||||
|
|
||||||
To share a volume between multiple containers, simply mount the same volume on multiple containers. Here's how to share `my-volume` between two containers running different images:
|
To share a volume between multiple containers, simply mount the same volume on multiple containers. Here's how to share `my-volume` between two containers running different images:
|
||||||
@@ -55,4 +58,4 @@ docker volume rm my-volume
|
|||||||
|
|
||||||
That's it! Now you have a basic understanding of volume mounts in Docker. You can use them to persist and share data between your containers efficiently and securely.
|
That's it! Now you have a basic understanding of volume mounts in Docker. You can use them to persist and share data between your containers efficiently and securely.
|
||||||
|
|
||||||
- [@article@Docker Volumes](https://docs.docker.com/storage/volumes/).
|
- [@article@Docker Volumes](https://docs.docker.com/storage/volumes/).
|
||||||
|
Reference in New Issue
Block a user