Skip to content

Commit 6e2e92d

Browse files
committed
Update docs/command output for volume pruning
In previous versions of the Docker API, `system prune --volumes` and `volume prune` would remove all dangling volumes. With API v1.42, this was changed so that only anonymous volumes would be removed unless the all filter was specified. Some of the docs were updated in #4218, however, there were a couple of places left that didn't make the anonymous vs named volumes distinction clear. This replaces #4079, which was bitrotted by #4218. See also #4028. Closes #4079. Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
1 parent 9bd5ec5 commit 6e2e92d

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

cli/command/system/prune.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command {
4848
flags := cmd.Flags()
4949
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")
5050
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones")
51-
flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune volumes")
51+
flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune anonymous volumes")
5252
flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label=<key>=<value>")`)
5353
// "filter" flag is available in 1.28 (docker 17.04) and up
5454
flags.SetAnnotation("filter", "version", []string{"1.28"})
@@ -114,7 +114,7 @@ func confirmationMessage(dockerCli command.Cli, options pruneOptions) string {
114114
"all networks not used by at least one container",
115115
}
116116
if options.pruneVolumes {
117-
warnings = append(warnings, "all volumes not used by at least one container")
117+
warnings = append(warnings, "all anonymous volumes not used by at least one container")
118118
}
119119
if options.all {
120120
warnings = append(warnings, "all images without at least one container associated to them")

cli/command/volume/prune.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
2727

2828
cmd := &cobra.Command{
2929
Use: "prune [OPTIONS]",
30-
Short: "Remove all unused local volumes",
30+
Short: "Remove unused local volumes",
3131
Args: cli.NoArgs,
3232
RunE: func(cmd *cobra.Command, args []string) error {
3333
spaceReclaimed, output, err := runPrune(dockerCli, options)

docs/reference/commandline/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ read the [`dockerd`](dockerd.md) reference page.
101101
| [volume create](volume_create.md) | Creates a new volume where containers can consume and store data |
102102
| [volume inspect](volume_inspect.md) | Display information about a volume |
103103
| [volume ls](volume_ls.md) | Lists all the volumes Docker knows about |
104-
| [volume prune](volume_prune.md) | Remove all unused local volumes |
104+
| [volume prune](volume_prune.md) | Remove unused local volumes |
105105
| [volume rm](volume_rm.md) | Remove one or more volumes |
106106

107107
### Swarm node commands

docs/reference/commandline/system_prune.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Remove unused data
1010
| `-a`, `--all` | | | Remove all unused images not just dangling ones |
1111
| [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label=<key>=<value>`) |
1212
| `-f`, `--force` | | | Do not prompt for confirmation |
13-
| `--volumes` | | | Prune volumes |
13+
| `--volumes` | | | Prune anonymous volumes |
1414

1515

1616
<!---MARKER_GEN_END-->
@@ -50,15 +50,15 @@ Total reclaimed space: 1.84kB
5050

5151
By default, volumes are not removed to prevent important data from being
5252
deleted if there is currently no container using the volume. Use the `--volumes`
53-
flag when running the command to prune volumes as well:
53+
flag when running the command to prune anonymous volumes as well:
5454

5555
```console
5656
$ docker system prune -a --volumes
5757

5858
WARNING! This will remove:
5959
- all stopped containers
6060
- all networks not used by at least one container
61-
- all volumes not used by at least one container
61+
- all anonymous volumes not used by at least one container
6262
- all images without at least one container associated to them
6363
- all build cache
6464
Are you sure you want to continue? [y/N] y

docs/reference/commandline/volume.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Manage volumes
1010
| [`create`](volume_create.md) | Create a volume |
1111
| [`inspect`](volume_inspect.md) | Display detailed information on one or more volumes |
1212
| [`ls`](volume_ls.md) | List volumes |
13-
| [`prune`](volume_prune.md) | Remove all unused local volumes |
13+
| [`prune`](volume_prune.md) | Remove unused local volumes |
1414
| [`rm`](volume_rm.md) | Remove one or more volumes |
1515
| [`update`](volume_update.md) | Update a volume (cluster volumes only) |
1616

docs/reference/commandline/volume_prune.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# volume prune
22

33
<!---MARKER_GEN_START-->
4-
Remove all unused local volumes
4+
Remove unused local volumes
55

66
### Options
77

0 commit comments

Comments
 (0)