Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker system prune warn message should display filters if any #850

Open
vdemeester opened this issue Jan 30, 2018 · 6 comments
Open

docker system prune warn message should display filters if any #850

vdemeester opened this issue Jan 30, 2018 · 6 comments

Comments

@vdemeester
Copy link
Collaborator

Description

When running a system prune with filter, the warning message doesn't reflect that the filter will be used.
We should display that the elements pruned will be filtered.

Describe the results you received:

$ docker system prune --filter=label=foo                                                                                                      Tue 30 Jan 2018 03:16:42 PM PST
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
# […]

Describe the results you expected:

Same message but that acknowledge the filtering.

@adshmh
Copy link
Contributor

adshmh commented Mar 2, 2018

@vdemeester Does an output like the following look OK?

$ docker system prune --filter=label=foo
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache

  Elements to be pruned will be filtered with:
      label=foo

@adshmh
Copy link
Contributor

adshmh commented Mar 2, 2018

Also it seems that volume, image, and container prune commands do not display the filter either.

@justyntemme
Copy link
Contributor

@vdemeester I have opened a PR to address this request. Please let me know if we would like to implement this any different way.

thaJeztah added a commit that referenced this issue May 21, 2018
Fix issue #850, Warn user of filter when pruning
@olejorgenb
Copy link

The merged MR doesn't seem to be in effect anymore? https://github.com/docker/cli/blob/master/cli/command/system/prune.go

It is quite jarring that the warning shouts "ALL" when I've applied a filter.

@thaJeztah
Copy link
Member

Filters are printed as part of the template at https://github.com/docker/cli/blob/master/cli/command/system/prune.go#L57

But not all objects (volumes, networks, containers, images) accept the same set of filters

@olejorgenb
Copy link

$ docker image prune --all --filter until=240h
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] n
$ docker --version
Docker version 20.10.7, build 20.10.7-0ubuntu5~21.04.2

Shouldn't the filter be displayed here? until is clearly supported by image prune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants