...
1# volume prune
2
3<!---MARKER_GEN_START-->
4Remove unused local volumes
5
6### Options
7
8| Name | Type | Default | Description |
9|:------------------------------|:---------|:--------|:---------------------------------------------------|
10| [`-a`](#all), [`--all`](#all) | | | Remove all unused volumes, not just anonymous ones |
11| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label=<label>`) |
12| `-f`, `--force` | | | Do not prompt for confirmation |
13
14
15<!---MARKER_GEN_END-->
16
17## Description
18
19Remove all unused local volumes. Unused local volumes are those which are not
20referenced by any containers. By default, it only removes anonymous volumes.
21
22## Examples
23
24```console
25$ docker volume prune
26
27WARNING! This will remove anonymous local volumes not used by at least one container.
28Are you sure you want to continue? [y/N] y
29Deleted Volumes:
3007c7bdf3e34ab76d921894c2b834f073721fccfbbcba792aa7648e3a7a664c2e
31my-named-vol
32
33Total reclaimed space: 36 B
34```
35
36### <a name="all"></a> Filtering (--all, -a)
37
38Use the `--all` flag to prune both unused anonymous and named volumes.
39
40### <a name="filter"></a> Filtering (--filter)
41
42The filtering flag (`--filter`) format is of "key=value". If there is more
43than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
44
45The currently supported filters are:
46
47* label (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) - only remove volumes with (or without, in case `label!=...` is used) the specified labels.
48
49The `label` filter accepts two formats. One is the `label=...` (`label=<key>` or `label=<key>=<value>`),
50which removes volumes with the specified labels. The other
51format is the `label!=...` (`label!=<key>` or `label!=<key>=<value>`), which removes
52volumes without the specified labels.
53
54## Related commands
55
56* [volume create](volume_create.md)
57* [volume ls](volume_ls.md)
58* [volume inspect](volume_inspect.md)
59* [volume rm](volume_rm.md)
60* [Understand Data Volumes](https://docs.docker.com/storage/volumes/)
61* [system df](system_df.md)
62* [container prune](container_prune.md)
63* [image prune](image_prune.md)
64* [network prune](network_prune.md)
65* [system prune](system_prune.md)
View as plain text