Skip to content

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

Merged
vvoland merged 1 commit intodocker:masterfrom
YoanWai:docs/prune-filter-behavior
Apr 3, 2026
Merged

docs: clarify multiple --filter behavior in prune commands#6889
vvoland merged 1 commit intodocker:masterfrom
YoanWai:docs/prune-filter-behavior

Conversation

@YoanWai
Copy link
Copy Markdown
Contributor

@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
@thaJeztah thaJeztah added this to the 29.4.0 milestone Apr 2, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@vvoland vvoland merged commit 512607a into docker:master Apr 3, 2026
112 of 113 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants