Skip to content

docs: improve documentation for "prune" commands specifying multiple (label) filters #5899

Open
@thaJeztah

Description

@thaJeztah

Description

This got in through the docs.docker.com feedback form;

The line " If there is more than one filter, then pass multiple flags (e.g., --filter "foo=bar" --filter "bif=baz")" unfortunately does NOT say if multiple filters are ANDed or ORed. For prune commands, this is very important, though.

It was reported for docker volume prune, but likely the same applies to other prune commands;
https://docs.docker.com/reference/cli/docker/volume/prune/

### <a name="filter"></a> Filtering (--filter)
The filtering flag (`--filter`) format is of "key=value". If there is more
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
The currently supported filters are:
* 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.
The `label` filter accepts two formats. One is the `label=...` (`label=<key>` or `label=<key>=<value>`),
which removes volumes with the specified labels. The other
format is the `label!=...` (`label!=<key>` or `label!=<key>=<value>`), which removes
volumes without the specified labels.

We need to verify the behavior (behavior of some of the filter options haven't been documented well when combined with other filters, or same filter applied multiple times), and update the documentation accordingly to make it less ambiguous.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions