docker / docker/cli

feature: Allow using expressions for filtering prune operations

Open
#3,557 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The linked entry point is cli/command/system/prune.go around line 131; start by tracing how repeated label filters are passed to prune operations. Define the supported expression or filter behavior, then verify that resources matching either listed label are excluded while existing filtering continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.