Skip to content

docs: clarify multiple --filter behavior in prune commands#6889

Open
YoanWai wants to merge 1 commit intodocker:masterfrom
YoanWai:docs/prune-filter-behavior
Open

docs: clarify multiple --filter behavior in prune commands#6889
YoanWai wants to merge 1 commit intodocker:masterfrom
YoanWai:docs/prune-filter-behavior

Conversation

@YoanWai
Copy link

@YoanWai YoanWai commented Mar 25, 2026

Summary

  • Adds documentation clarifying how multiple --filter flags interact in all prune commands (container, image, network, system, volume)
  • Different filter keys (e.g., --filter "label=foo" --filter "until=24h") are combined using AND logic: an item must satisfy all conditions to be pruned
  • Multiple values for the same filter key (e.g., --filter "label=foo" --filter "label=bar") are combined using OR logic: an item is pruned if it matches any of the values
  • Includes concrete examples for each prune command to illustrate the behavior

This behavior is confirmed by the Filters type definition in the Docker client library, which documents: "A filter term is satisfied if any one of the values in the set is a match. An item matches the filters when all terms are satisfied."

Test plan

  • Verify markdown renders correctly on GitHub
  • Verify the documented AND/OR behavior matches the Filters type contract in vendor/github.com/moby/moby/client/filters.go

Closes #5899

@YoanWai YoanWai requested review from a team and thaJeztah as code owners March 25, 2026 15:33
Document how multiple --filter flags interact in prune commands:
different filter keys are ANDed (all conditions must match), while
multiple values for the same key are ORed (any value can match).

This addresses a gap in the documentation where users could not
determine whether multiple filters were combined with AND or OR
logic, which is especially important for prune commands where
the wrong assumption could lead to unintended data removal.

Closes docker#5899

Signed-off-by: Yoan Wainmann <yoan@mreshet.co.il>
@YoanWai YoanWai force-pushed the docs/prune-filter-behavior branch from 0a7e393 to d573c17 Compare March 25, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant