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

podman system prune --filter="label!=key" doesn't work #14182

Closed
jkonecny12 opened this issue May 10, 2022 · 8 comments · Fixed by #14997
Closed

podman system prune --filter="label!=key" doesn't work #14182

jkonecny12 opened this issue May 10, 2022 · 8 comments · Fixed by #14997
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@jkonecny12
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When calling podman system prune --filter="label!=com.test.test" I'm getting error output:

Error: label! is an invalid filter

Steps to reproduce the issue:

  1. Call podman system prune --filter="label!=com.test.test"

Describe the results you received:

WARNING! This command removes:
	- all stopped containers
	- all networks not used by at least one container
	- all dangling images
	- all dangling build cache

Are you sure you want to continue? [y/N] y
Error: label! is an invalid filter

Describe the results you expected:

I should be able to prune all the images and containers which doesn't contain given label.

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

Happens all the time.

Output of podman version:

Client:       Podman Engine
Version:      4.0.3
API Version:  4.0.3
Go Version:   go1.18
Built:        Fri Apr  1 20:21:54 2022
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.24.3
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpus: 12
  distribution:
    distribution: fedora
    variant: silverblue
    version: "36"
  eventLogger: journald
  hostname: loki.packetseekers.eu
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.17.5-300.fc36.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 5937229824
  memTotal: 33382322176
  networkBackend: cni
  ociRuntime:
    name: crun
    package: crun-1.4.4-1.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.4
      commit: 6521fcc5806f20f6187eb933f9f45130c86da230
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.x86_64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 8584425472
  swapTotal: 8589930496
  uptime: 10h 33m 12.19s (Approximately 0.42 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /var/home/jkonecny/.config/containers/storage.conf
  containerStore:
    number: 17
    paused: 0
    running: 4
    stopped: 13
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.8.1-3.fc36.x86_64
      Version: |-
        fusermount3 version: 3.10.5
        fuse-overlayfs: version 1.8.1
        FUSE library version 3.10.5
        using FUSE kernel interface version 7.31
  graphRoot: /var/home/jkonecny/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 741
  runRoot: /run/user/1000/containers
  volumePath: /var/home/jkonecny/.local/share/containers/storage/volumes
version:
  APIVersion: 4.0.3
  Built: 1648837314
  BuiltTime: Fri Apr  1 20:21:54 2022
  GitCommit: ""
  GoVersion: go1.18
  OsArch: linux/amd64
  Version: 4.0.3

Package info (e.g. output of rpm -q podman or apt list podman):

podman-4.0.3-1.fc36.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

No

Additional environment details (AWS, VirtualBox, physical, etc.):

Fedora 36 but it happened also on Fedora 35.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label May 10, 2022
@jkonecny12 jkonecny12 changed the title podman system prune --filter="label!key" doesn't work podman system prune --filter="label!=key" doesn't work May 10, 2022
@jkonecny12
Copy link
Author

Just to give you information about my exact use-case. The system prune --filter could be used with label!=com.github.containers.toolbox to cleanup everything except toolbox specific stuff.

@lovette
Copy link

lovette commented May 19, 2022

Filter negation was recently added to the images command through #13270. That change may not have been applied to all commands.

@rhatdan
Copy link
Member

rhatdan commented May 19, 2022

@jkonecny12 Can I close this issue?

@jkonecny12
Copy link
Author

Hi @rhatdan if I understand it correctly than this is not resolved. The change pointed above should be extended also to the prune command. If that is true, than this should not be closed.

@rhatdan
Copy link
Member

rhatdan commented May 23, 2022

Ok is anyone interested in making this change? Has anyone verified that this is not already fixed? Since podman system prune uses the same library, at least for images, this should be fixed.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jun 27, 2022

@cdoern PTAL

@cdoern cdoern added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Jul 11, 2022
cdoern added a commit to cdoern/common that referenced this issue Jul 11, 2022
there was some eerily similar code in c/common and in podman for
creating filter functions for various types. Move some of it here
and add support for the label!= filter in libimage and libnetwork that basically creates the inverse
function of label=

after this merges, will file a PR with the fix for containers within podman as well

there is already a label!= test in libimage/filters_test. Libimage somehow lets this syntax slide
even though it does not actually imact anything in podman

see containers/podman#14182

Signed-off-by: Charlie Doern <[email protected]>
cdoern added a commit to cdoern/common that referenced this issue Jul 14, 2022
there was some eerily similar code in c/common and in podman for
creating filter functions for various types. Move some of it here
and add support for the label!= filter in libimage and libnetwork that basically creates the inverse
function of label=

after this merges, will file a PR with the fix for containers within podman as well

there is already a label!= test in libimage/filters_test. Libimage somehow lets this syntax slide
even though it does not actually imact anything in podman

see containers/podman#14182

Signed-off-by: Charlie Doern <[email protected]>
cdoern added a commit to cdoern/common that referenced this issue Jul 15, 2022
there was some eerily similar code in c/common and in podman for
creating filter functions for various types. Move some of it here
and add support for the label!= filter in libnetwork only. Libimage already supports it.

after this merges, will file a PR with the fix for containers within podman as well

see containers/podman#14182

Signed-off-by: Charlie Doern <[email protected]>
cdoern added a commit to cdoern/podman that referenced this issue Jul 25, 2022
network and container prune could not handle the label!=... filter. vendor in c/common to fix this and
add some podman level handling to make everything run smoothly

resolves containers#14182

Signed-off-by: Charlie Doern <[email protected]>
@jkonecny12
Copy link
Author

Thanks for fixing this!

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants