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

[17.06] Error if "until" filter is combined with "--volumes" on system prune #154

Merged
merged 1 commit into from Aug 2, 2017

Conversation

Projects
None yet
3 participants
@thaJeztah
Member

thaJeztah commented Aug 1, 2017

cherry picked from commit docker/cli@3c095dc (docker/cli#311)

conflicted with f7a9f9f (#109)

The "until" filter is supported by all object types, except for
volumes.

Before this patch, the "until" filter would attempted to be used for the volume
prune endpoint, resulting in an error being returned by the daemon, and
further prune endpoints (networks, images) to be skipped.

$ docker system prune --filter until=24h --filter label=label.foo=bar

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'

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
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
Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
Error response from daemon: Invalid filter 'until'

With this patch, an error is produced instead, preventing "partial" prune.

$ docker system prune --filter until=24h --filter label=foo==bar --volumes
ERROR: The "until" filter is not supported with "--volumes"

Note that docker volume prune does not have this problem, and produces an
error if the until filter is used;

$ docker volume prune --filter until=24h

WARNING! This will remove all volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Error response from daemon: Invalid filter 'until'
Error if "until" filter is combined with "--volumes" on system prune
The "until" filter is supported by all object types, except for
volumes.

Before this patch, the "until" filter would attempted to be used for the volume
prune endpoint, resulting in an error being returned by the daemon, and
further prune endpoints (networks, images) to be skipped.

    $ docker system prune --filter until=24h --filter label=label.foo=bar

    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'

    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
    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
    Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
    Error response from daemon: Invalid filter 'until'

With this patch, an error is produced instead, preventing "partial" prune.

    $ docker system prune --filter until=24h --filter label=foo==bar --volumes
    ERROR: The "until" filter is not supported with "--volumes"

Note that `docker volume prune` does not have this problem, and produces an
error if the `until` filter is used;

    $ docker volume prune --filter until=24h

    WARNING! This will remove all volumes not used by at least one container.
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3c095dc546e9c90afcfb1ca1695b408d813b4306)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah
Member

thaJeztah commented Aug 1, 2017

@dnephin

dnephin approved these changes Aug 1, 2017

LGTM

@andrewhsu

LGTM

@andrewhsu andrewhsu added this to the 17.06.1 milestone Aug 1, 2017

@andrewhsu andrewhsu merged commit 2e36049 into docker:17.06 Aug 2, 2017

2 of 3 checks passed

ce-tests-WoW-RS1 Jenkins build docker-ce-pr-WoW-RS1 258 has failed
Details
ce-tests Jenkins build docker-ce-pr 61 has succeeded
Details
dco-signed All commits are signed

@thaJeztah thaJeztah deleted the thaJeztah:17.06-backport-prune-until-filter branch Aug 2, 2017

tophj-ibm pushed a commit to tophj-ibm/docker-ce that referenced this pull request Aug 29, 2017

Merge pull request docker#154 from tiborvass/add-man-docs-scripts
Add scripts and targets for manpages and yamldocs
Upstream-commit: ed5b66308222511bd9e2e4e7e2c278d9887d0142
Component: cli

docker-jenkins pushed a commit that referenced this pull request Aug 23, 2018

Merge pull request #154 from seemethere/fix_up_dockerfile
Fix up Dockerfile.engine to compile docker-proxy statically
Upstream-commit: 8f1a3c9032a09fc27be25267df9d500ce5e60e15
Component: packaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment