storage: anonymous volumes are ephemeral with --rm

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2023-12-29 10:43:31 +01:00
parent 8cf0694f2c
commit 052f261c6a
1 changed files with 7 additions and 5 deletions

View File

@ -73,11 +73,13 @@ running container is using a volume, the volume is still available to Docker
and isn't removed automatically. You can remove unused volumes using `docker and isn't removed automatically. You can remove unused volumes using `docker
volume prune`. volume prune`.
When you mount a volume, it may be named or anonymous. Anonymous When you mount a volume, it may be named or anonymous. Anonymous volumes are
volumes aren't given an explicit name when they're first mounted into a given a random name that's guaranteed to be unique within a given Docker host.
container, so Docker gives them a random name that's guaranteed to be unique Just like named volumes, anonymous volumes persist even if you remove the
within a given Docker host. Besides the name, named and anonymous volumes container that uses them, except if you use the `--rm` flag when creating the
behave in the same ways. container. Docker automatically removes anonymous volume mounts for containers
created with the `--rm` flag. See [Remove anonymous
volumes](volumes.md#remove-anonymous-volumes).
Volumes also support the use of volume drivers, which allow you to store Volumes also support the use of volume drivers, which allow you to store
your data on remote hosts or cloud providers, among other possibilities. your data on remote hosts or cloud providers, among other possibilities.