Description
Steps to reproduce the issue:
docker system prune --filter "label=foobar" --all --forceDescribe 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
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'
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.
Pull request here #1522
This should be resolved by https://github.com/moby/moby/pull/38238, which will be included in 18.09.1 through https://github.com/docker/engine/pull/122
The 'until' filter does not appear to be fixed in 18.09.1.
@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
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.
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; https://github.com/moby/moby/issues/30623 https://github.com/docker/cli/issues/763
Closing this ticket, because the issue originally reported here is fixed 馃憤
Most helpful comment
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.