docker/cli · error · invalidParamErr

conflicting options: cannot specify both --all and --filter

Error message

conflicting options: cannot specify both --all and --filter all=1

What it means

Raised by `docker volume prune` when the --all/-a flag is combined with an explicit `--filter all=1` (or all=true). --all is implemented by adding the `all=true` prune filter internally, so specifying both is redundant and potentially contradictory; the CLI rejects it as an invalid parameter.

Source

Thrown at cli/command/volume/prune.go:78

	flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label=<label>")`)

	return cmd
}

const (
	unusedVolumesWarning = `WARNING! This will remove anonymous local volumes not used by at least one container.
Are you sure you want to continue?`
	allVolumesWarning = `WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue?`
)

func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, _ error) {
	pruneFilters := command.PruneFilters(dockerCli, options.filter.Value())

	warning := unusedVolumesWarning
	if options.all {
		if _, ok := pruneFilters["all"]; ok {
			return 0, "", invalidParamErr{errors.New("conflicting options: cannot specify both --all and --filter all=1")}
		}
		pruneFilters.Add("all", "true")
		warning = allVolumesWarning
	}
	if !options.force {
		r, err := prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), warning)
		if err != nil {
			return 0, "", err
		}
		if !r {
			return 0, "", cancelledErr{errors.New("volume prune has been cancelled")}
		}
	}

	res, err := dockerCli.Client().VolumePrune(ctx, client.VolumePruneOptions{
		Filters: pruneFilters,
	})
	if err != nil {

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Use just one form: `docker volume prune --all` (preferred on modern CLI/API >= 1.42).
  2. Or keep only the filter form: `docker volume prune --filter all=1` and drop -a/--all.
  3. Audit wrapper scripts so they don't add --all when the user already passed an all filter.

Example fix

# before
docker volume prune --all --filter all=1 -f
# after
docker volume prune --all -f

When it happens

Trigger: `docker volume prune --all --filter all=1` — options.all is true and pruneFilters already contains an "all" key at cli/command/volume/prune.go:78.

Common situations: Scripts written for older API versions using `--filter all=1` (the pre---all way to include named volumes) later updated to add -a as well; copy-pasted commands mixing both idioms; wrapper tools that inject --all onto user-supplied filter sets.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/7f9fa14acb5037b4.json. Report an issue: GitHub.