From 052f261c6aa47addf30c9767c6c5c184c56daacf Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Fri, 29 Dec 2023 10:43:31 +0100 Subject: [PATCH] storage: anonymous volumes are ephemeral with --rm Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- content/storage/_index.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/content/storage/_index.md b/content/storage/_index.md index 9e63a9869a..2d9dfa0b41 100644 --- a/content/storage/_index.md +++ b/content/storage/_index.md @@ -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 volume prune`. -When you mount a volume, it may be named or anonymous. Anonymous -volumes aren't given an explicit name when they're first mounted into a -container, so Docker gives them a random name that's guaranteed to be unique -within a given Docker host. Besides the name, named and anonymous volumes -behave in the same ways. +When you mount a volume, it may be named or anonymous. Anonymous volumes are +given a random name that's guaranteed to be unique within a given Docker host. +Just like named volumes, anonymous volumes persist even if you remove the +container that uses them, except if you use the `--rm` flag when creating the +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 your data on remote hosts or cloud providers, among other possibilities.