Skip to content

Commit 94c2be0

Browse files
committed
Clarify that --rm works with detached containers
Add clarification in the 'Remove anonymous volumes' section that the --rm option works with both foreground and detached (-d) containers. Anonymous volumes are cleaned up when the container exits, regardless of how it was started. Fixes #19717 Assisted-By: docker-agent
1 parent 55e175d commit 94c2be0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

content/manuals/engine/storage/volumes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,9 @@ To automatically remove anonymous volumes, use the `--rm` option. For example,
784784
this command creates an anonymous `/foo` volume. When you remove the container,
785785
the Docker Engine removes the `/foo` volume but not the `awesome` volume.
786786

787+
The `--rm` option works with both foreground and detached (`-d`) containers.
788+
The anonymous volumes are cleaned up when the container exits.
789+
787790
```console
788791
$ docker run --rm -v /foo -v awesome:/bar busybox top
789792
```

0 commit comments

Comments
 (0)