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

timestamps don't work in docker system prune's 'until' filter #2071

Closed
RazerM opened this issue Aug 29, 2019 · 7 comments
Closed

timestamps don't work in docker system prune's 'until' filter #2071

RazerM opened this issue Aug 29, 2019 · 7 comments

Comments

@RazerM
Copy link

RazerM commented Aug 29, 2019

Description

The documentation for docker system prune on 19.03 states that the until filter supports timestamps, but it doesn't work.

Steps to reproduce the issue:

  1. Run docker system prune --force --all --filter "until=2006-01-02T15:04:05"

Describe the results you received:

Error response from daemon: failed to prune build cache: "until" filter expects a duration (e.g., '24h'): time: unknown unit - in duration 2006-01-02T15:04:05

Describe the results you expected:
The prune to work with the timestamp.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:22:03 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:20:35 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 42
  Running: 0
  Paused: 0
  Stopped: 42
 Images: 144
 Server Version: 19.03.1
 Storage Driver: aufs
  Root Dir: /var/lib/docker/aufs
  Backing Filesystem: extfs
  Dirs: 611
  Dirperm1 Supported: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan 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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.19.0-5-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 15.62GiB
 Name: server123
 ID: ZSS4:GQ3D:IWCX:FTWI:WBPU:7X4W:AMW7:6JWJ:ISPK:PSBG:HZXH:J6MU
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: the aufs storage-driver is deprecated, and will be removed in a future release.
@pasuder
Copy link

pasuder commented Feb 18, 2022

While looking for option to cleanup orphaned things, I tried to use following approach:

linux:~$ docker system prune --filter 'until=7d'
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

  Items to be pruned will be filtered with:
  - until=7d

Are you sure you want to continue? [y/N] y
Error response from daemon: failed to parse value as time or duration: "7d"

linux:~$ docker system prune --filter 'until=1w'
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

  Items to be pruned will be filtered with:
  - until=1w

Are you sure you want to continue? [y/N] y
Error response from daemon: failed to parse value as time or duration: "1w"

It looks that only hour does work. day and week does not work

linux:~$ docker version
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:33 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:42 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Relates to #1512

@koelle25
Copy link

The problem is also with all other prune options, e.g. docker container prune --filter 'until=7d' or docker image prune --filter 'until=7d'.

Indeed, as @pasuder says, docker system prune --filter 'until=168h' works like a charm (7 days * 24 hours = 168 hours).

@Alexivia
Copy link

Alexivia commented Aug 2, 2023

Same happening to me. Days and weeks not working. Sad to see that this has been flagged since 2019 though...

@Richard-Walton
Copy link

Still an issue here :(

@jwaes
Copy link

jwaes commented Dec 15, 2023

Bump !

@vvoland
Copy link
Collaborator

vvoland commented Dec 15, 2023

This is already fixed and was first included in the 24.0 version of the Docker Engine: moby/moby#45294

@vvoland vvoland closed this as completed Dec 15, 2023
@Janosch
Copy link

Janosch commented Feb 3, 2024

FYI, days and weeks durations (1m or 1w) are not working by design, see also #4390. So it is not a bug, but would still be helpful to have that feature.

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

9 participants