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 --filter label=... throws an error, saying "Invalid filter 'label'" #1512

Closed
DavidZemon opened this issue Nov 12, 2018 · 10 comments
Labels
Milestone

Comments

@DavidZemon
Copy link

Description

Steps to reproduce the issue:

  1. Run docker system prune --filter "label=foobar" --all --force

Describe the results you received:
Console shows error message Error response from daemon: failed to prune build cache: Invalid filter 'label' and return code is 1.

Describe the results you expected:
Successful completion of the command. Removal of any images that contain the label "foobar" or a message saying nothing was removed.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:57 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:16:44 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 13
 Running: 13
 Paused: 0
 Stopped: 0
Images: 10
Server Version: 18.09.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 119
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-1070-aws
Operating System: Ubuntu 16.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.22GiB
Name: pool1
ID: WGVM:DXZS:G7JE:5LTW:B7DG:MZY7:HIYP:ARHO:MTDC:TEBR:FO2X:VULJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support

Running on AWS, installed via the docker-ce package provided by the following apt line: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable

@xanderhades
Copy link

Hello,

we have a similar issue with the 'until' filter.

It was working before the recent 18.09 engine release.

Steps to reproduce the issue:

root@host:~# docker system prune --all --force --filter 'until=2h'  
Error response from daemon: failed to prune build cache: Invalid filter 'until'

@ArmaneS
Copy link

ArmaneS commented Nov 14, 2018

Hi,
the same issue appears to be when try running with the following commands:

docker system prune --force --filter 'label!=key=value'
Error response from daemon: Invalid filter 'label!'

Also, when try to prune with the filter like "until=2018-10-10" it does not remove old images.

@xanderhades
Copy link

Pull request here #1522

@thaJeztah
Copy link
Member

This should be resolved by moby/moby#38238, which will be included in 18.09.1 through docker-archive/engine#122

@bradwilson
Copy link

The 'until' filter does not appear to be fixed in 18.09.1.

@thaJeztah
Copy link
Member

@bradwilson what are you seeing on 18.09.1? I just tried reproducing the issue, but it succeeded on 18.09.1;

docker system prune --filter 'until=2h'
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all dangling build cache
        - Elements to be pruned will be filtered with:
        - label={"until":{"2h":true}}
Are you sure you want to continue? [y/N] y
Deleted Containers:
bb5b4336cc243288b8d17beaa74c3b48db1dd440636ef2ccc27b2e783048a741
b9ff7e92023513080a7ec98143af80a66022ca850f400431826a5912222394c9
...
...

Total reclaimed space: 2.379GB

@bradwilson
Copy link

Ah, I realize now that it works in prune, but not in docker images, which is a shame since testing a filter in list before using it to delete makes the operation safer.

@thaJeztah
Copy link
Member

Ah, yes docker image ls does not have a filter based on time yet. Feel free to open a new ticket for that though, so that it can be discussed.

There a separate issue for adding a --dry-run option on docker system prune; moby/moby#30623 #763

@thaJeztah thaJeztah added this to the 18.09.1 milestone Jan 25, 2019
@thaJeztah
Copy link
Member

Closing this ticket, because the issue originally reported here is fixed 👍

@michaelschem
Copy link

This seems to either be not fixed or broken again.

docker system prune --filter "label=foobar" --all --force

does not work

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

No branches or pull requests

6 participants