docs: clarify multiple --filter behavior in prune commands#6889
Open
YoanWai wants to merge 1 commit intodocker:masterfrom
Open
docs: clarify multiple --filter behavior in prune commands#6889YoanWai wants to merge 1 commit intodocker:masterfrom
YoanWai wants to merge 1 commit intodocker:masterfrom
Conversation
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>
0a7e393 to
d573c17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--filterflags interact in all prune commands (container, image, network, system, volume)--filter "label=foo" --filter "until=24h") are combined using AND logic: an item must satisfy all conditions to be pruned--filter "label=foo" --filter "label=bar") are combined using OR logic: an item is pruned if it matches any of the valuesThis behavior is confirmed by the
Filterstype 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
Filterstype contract invendor/github.com/moby/moby/client/filters.goCloses #5899