From 08ad72160ff01c81d605821051294be6cb710ac5 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:19:17 +0100 Subject: [PATCH] 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> (cherry picked from commit 6e2e92d774eccdd7f5cf3e08210ca34a1a75643b) Signed-off-by: Sebastiaan van Stijn --- cli/command/system/prune.go | 4 ++-- cli/command/volume/prune.go | 2 +- docs/reference/commandline/index.md | 2 +- docs/reference/commandline/system_prune.md | 6 +++--- docs/reference/commandline/volume.md | 2 +- docs/reference/commandline/volume_prune.md | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/command/system/prune.go b/cli/command/system/prune.go index 51773cce3a..9a4e88fd77 100644 --- a/cli/command/system/prune.go +++ b/cli/command/system/prune.go @@ -48,7 +48,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones") - flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune volumes") + flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune anonymous volumes") flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label==")`) // "filter" flag is available in 1.28 (docker 17.04) and up flags.SetAnnotation("filter", "version", []string{"1.28"}) @@ -114,7 +114,7 @@ func confirmationMessage(dockerCli command.Cli, options pruneOptions) string { "all networks not used by at least one container", } if options.pruneVolumes { - warnings = append(warnings, "all volumes not used by at least one container") + warnings = append(warnings, "all anonymous volumes not used by at least one container") } if options.all { warnings = append(warnings, "all images without at least one container associated to them") diff --git a/cli/command/volume/prune.go b/cli/command/volume/prune.go index a85cb38833..d4ed935da9 100644 --- a/cli/command/volume/prune.go +++ b/cli/command/volume/prune.go @@ -27,7 +27,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ Use: "prune [OPTIONS]", - Short: "Remove all unused local volumes", + Short: "Remove unused local volumes", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { spaceReclaimed, output, err := runPrune(dockerCli, options) diff --git a/docs/reference/commandline/index.md b/docs/reference/commandline/index.md index 0dc074d676..2dd4e7e4d0 100644 --- a/docs/reference/commandline/index.md +++ b/docs/reference/commandline/index.md @@ -101,7 +101,7 @@ read the [`dockerd`](dockerd.md) reference page. | [volume create](volume_create.md) | Creates a new volume where containers can consume and store data | | [volume inspect](volume_inspect.md) | Display information about a volume | | [volume ls](volume_ls.md) | Lists all the volumes Docker knows about | -| [volume prune](volume_prune.md) | Remove all unused local volumes | +| [volume prune](volume_prune.md) | Remove unused local volumes | | [volume rm](volume_rm.md) | Remove one or more volumes | ### Swarm node commands diff --git a/docs/reference/commandline/system_prune.md b/docs/reference/commandline/system_prune.md index 72b7d80f9f..728cb87fce 100644 --- a/docs/reference/commandline/system_prune.md +++ b/docs/reference/commandline/system_prune.md @@ -10,7 +10,7 @@ Remove unused data | `-a`, `--all` | | | Remove all unused images not just dangling ones | | [`--filter`](#filter) | `filter` | | Provide filter values (e.g. `label==`) | | `-f`, `--force` | | | Do not prompt for confirmation | -| `--volumes` | | | Prune volumes | +| `--volumes` | | | Prune anonymous volumes | @@ -50,7 +50,7 @@ Total reclaimed space: 1.84kB By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the `--volumes` -flag when running the command to prune volumes as well: +flag when running the command to prune anonymous volumes as well: ```console $ docker system prune -a --volumes @@ -58,7 +58,7 @@ $ docker system prune -a --volumes WARNING! This will remove: - all stopped containers - all networks not used by at least one container - - all volumes not used by at least one container + - all anonymous volumes not used by at least one container - all images without at least one container associated to them - all build cache Are you sure you want to continue? [y/N] y diff --git a/docs/reference/commandline/volume.md b/docs/reference/commandline/volume.md index 8f30002523..9f2d7888e7 100644 --- a/docs/reference/commandline/volume.md +++ b/docs/reference/commandline/volume.md @@ -10,7 +10,7 @@ Manage volumes | [`create`](volume_create.md) | Create a volume | | [`inspect`](volume_inspect.md) | Display detailed information on one or more volumes | | [`ls`](volume_ls.md) | List volumes | -| [`prune`](volume_prune.md) | Remove all unused local volumes | +| [`prune`](volume_prune.md) | Remove unused local volumes | | [`rm`](volume_rm.md) | Remove one or more volumes | | [`update`](volume_update.md) | Update a volume (cluster volumes only) | diff --git a/docs/reference/commandline/volume_prune.md b/docs/reference/commandline/volume_prune.md index 4230c6efe3..9c923df325 100644 --- a/docs/reference/commandline/volume_prune.md +++ b/docs/reference/commandline/volume_prune.md @@ -1,7 +1,7 @@ # volume prune -Remove all unused local volumes +Remove unused local volumes ### Options