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 ps -a --filter "status=exited" does not work #5050

Closed
groovyman opened this issue Feb 2, 2020 · 2 comments · Fixed by #5075
Closed

podman ps -a --filter "status=exited" does not work #5050

groovyman opened this issue Feb 2, 2020 · 2 comments · Fixed by #5075
Labels
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

@groovyman
Copy link

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

/kind bug

Description
I am unable to filter for Stopped or exited container. I can filter for "status=running" but i am unable to use "status=exited". The bash Script is used on the host container to start/stop root-less container on system startup or shutdown.

So shutdown is not an issue, i perform:
podman ps --filter "status=running" --format "{{.ID}} {{.Image}}" | while read CONT_ID CONT_IMG do echo "shutdown podmans ${CONT_ID} ${CONT_IMG} " podman stop ${CONT_ID} done
But on system-startup i have to do use a workaround like this:
podman ps -a --format "{{.ID}} {{.Image}} {{.Status}} " | grep kivi | grep Exited | while read CONT_ID CONT_IMG CONT_STATUS do echo "starting podmans ${CONT_ID} ${CONT_IMG} " podman start ${CONT_ID} done

Steps to reproduce the issue:

  1. podman ps -a --filter "status=exited" does not filter correctly

Describe the results you received:
I receive no result when filtering for exited container

Describe the results you expected:
I would like to run this:
podman ps --filter "status=exited" --format "{{.ID}} {{.Image}} {{.Status}} " | grep kivi | grep Exited | while read CONT_ID CONT_IMG CONT_STATUS

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

Output of podman version:

podman-1.7.0-2.fc31.x86_64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.13.5
  podman version: 1.7.0
host:
  BuildahVersion: 1.12.0
  CgroupVersion: v2
  Conmon:
    package: conmon-2.0.10-2.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.10, commit: 6b526d9888abb86b9e7de7dfdeec0da98ad32ee0'
  Distribution:
    distribution: fedora
    version: "31"
  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
  MemFree: 8616271872
  MemTotal: 16744177664
  OCIRuntime:
    name: crun
    package: crun-0.10.6-1.fc31.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.10.6
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  SwapFree: 32002531328
  SwapTotal: 32002531328
  arch: amd64
  cpus: 8
  eventlogger: journald
  hostname: suggs
  kernel: 5.4.15-200.fc31.x86_64
  os: linux
  rootless: true
  slirp4netns:
    Executable: /usr/bin/slirp4netns
    Package: slirp4netns-0.4.0-20.1.dev.gitbbd6f25.fc31.x86_64
    Version: |-
      slirp4netns version 0.4.0-beta.3+dev
      commit: bbd6f25c70d5db2a1cd3bfb0416a8db99a75ed7e
  uptime: 5h 22m 49.45s (Approximately 0.21 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - quay.io
store:
  ConfigFile: /home/cgroove/.config/containers/storage.conf
  ContainerStore:
    number: 3
  GraphDriverName: overlay
  GraphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-0.7.5-2.fc31.x86_64
      Version: |-
        fusermount3 version: 3.6.2
        fuse-overlayfs: version 0.7.5
        FUSE library version 3.6.2
        using FUSE kernel interface version 7.29
  GraphRoot: /home/cgroove/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 77
  RunRoot: /run/user/1000
  VolumePath: /home/cgroove/.local/share/containers/storage/volumes

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

podman-1.7.0-2.fc31.x86_64

Additional environment details (AWS, VirtualBox, physical, etc.):
It's a Fedora Box.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 2, 2020
@groovyman
Copy link
Author

/kind bug

@mheon
Copy link
Member

mheon commented Feb 3, 2020

The filter itself is working, but Podman seems to be retaining the default behavior (show only running containers) even when --filter is passed; Docker does not, and filters all containers, even stopped ones.

mheon added a commit to mheon/libpod that referenced this issue Feb 4, 2020
When we filter, it should be out of all containers, not just
running ones, by default - this is necessary to ensure Docker
compatability.

Fixes containers#5050

Signed-off-by: Matthew Heon <[email protected]>
@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

3 participants