Originally reported by @twooster in moby/moby#31122 (comment)
When running docker system prune with an until filter, pruning fails and does not remove images, volumes, and networks.
Error response from daemon: Invalid filter 'until'
The cause of this is that all resources (containers, images, networks) support filtering by until except volumes. The docker system prune sequentially calls the various prune commands, and when it calls the docker volume prune endpoint, an error is returned by the daemon, and pruning stops;
# docker system prune --filter until=24h
WARNING! This will remove:
- all stopped containers
- all volumes not used by at least one container
- all networks not used by at least one container
- all dangling images
Are you sure you want to continue? [y/N] y
Error response from daemon: Invalid filter 'until'
Daemon logs;
DEBU[1185] Calling POST /v1.30/containers/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
DEBU[1185] Calling POST /v1.30/volumes/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
ERRO[1185] Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
Error response from daemon: Invalid filter 'until'
# docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:23:31 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:19:04 2017
OS/Arch: linux/amd64
Experimental: false
We need to remove the until filter for the "volume prune" endpoint (but only when called as part of system prune, not when directly calling docker volume prune).
Given that we don't support a client talking to a newer API version, it should not be a problem to simply remove the filter, as long as we don't forget to remove that part of the code once volumes do support the until filter.
Perhaps we need to print a warning if the filter is used, because skipping the filter may result in removing more volumes than the user possibly intended?
/cc @cpuguy83 wdyt?
Originally reported by @twooster in moby/moby#31122 (comment)
When running
docker system prunewith anuntilfilter, pruning fails and does not remove images, volumes, and networks.The cause of this is that all resources (containers, images, networks) support filtering by
untilexcept volumes. Thedocker system prunesequentially calls the various prune commands, and when it calls thedocker volume pruneendpoint, an error is returned by the daemon, and pruning stops;Daemon logs;
We need to remove the
untilfilter for the "volume prune" endpoint (but only when called as part ofsystem prune, not when directly callingdocker volume prune).Given that we don't support a client talking to a newer API version, it should not be a problem to simply remove the filter, as long as we don't forget to remove that part of the code once volumes do support the
untilfilter.Perhaps we need to print a warning if the filter is used, because skipping the filter may result in removing more volumes than the user possibly intended?
/cc @cpuguy83 wdyt?