cli icon indicating copy to clipboard operation
cli copied to clipboard

feature: Allow using expressions for filtering prune operations

Open pupseba opened this issue 2 years ago • 0 comments

https://github.com/docker/cli/blob/a32cd16160f1b41c1c4ae7bee4dac929d1484e59/cli/command/system/prune.go#L131

Currently is not possible to execute prune operations using filters to exclude with "OR" logic.

Assume one would like docker system prune to exclude all resources with either one of these labels:

io.kubernetes.container.name=name-01 io.kubernetes.container.name=name-02

Executing docker system prune -f --volumes --filter "label!=io.kubernetes.container.name=name-01" --filter "label!=io.kubernetes.container.name=name-02" will result only in resources with both labels (AND) being excluded from the prune operation instead of resulting in a prune operation that filters out one or (OR) the other, prunning everything except those resources with any of those labels.

Having the possibility at least to use regex or go templating to pass filters would be desired.

pupseba avatar Apr 13 '22 12:04 pupseba