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: --filter option has different behaviour than docker #1341

Closed
EmilienM opened this issue Aug 24, 2018 · 6 comments
Closed

podman-ps: --filter option has different behaviour than docker #1341

EmilienM opened this issue Aug 24, 2018 · 6 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@EmilienM
Copy link
Contributor

EmilienM commented Aug 24, 2018

/kind bug

Description

When using podman-ps, --filter option has a a different behaviour than docker CLI.

Steps to reproduce the issue:

podman ps -a --filter "label=container_name=keystone" --filter "label=config_id=tripleo_step3" --format {{.Names}}

Describe the results you received:

All containers with config_id=tripleo_step3 are returned.

Describe the results you expected:

It should return containers with container_name=keystone AND config_id=tripleo_step3.

How to make it work:
podman ps -a --filter label=container_name=keystone label=config_id=tripleo_step3 --format {{.Names}}

This command returned what I needed.

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

A few notes about how it works with Docker:

This command doesn't work:
docker ps -a --filter label=container_name=keystone label=config_id=tripleo_step3 --format {{.Names}}

While this one worked and returned what we expected:
docker ps -a --filter label=container_name=keystone --filter label=config_id=tripleo_step3 --format {{.Names}}

Output of podman version:

Version: 0.8.4-dev
Go Version: go1.10.3
OS/Arch: linux/amd64

Output of podman info:
host:
Conmon:
package: podman-0.8.2.1-1.gitf38eb4f.el7.x86_64
path: /usr/libexec/podman/conmon
version: 'conmon version 1.12.0-dev, commit: 74bba30adae4fdcacf887d35e4d6331318765028-dirty'
MemFree: 269758464
MemTotal: 8201699328
OCIRuntime:
package: runc-1.0.0-37.rc5.dev.gitad0f525.el7.x86_64
path: /usr/bin/runc
version: 'runc version spec: 1.0.0'
SwapFree: 1609035776
SwapTotal: 1610608640
arch: amd64
cpus: 4
hostname: undercloud75.localdomain
kernel: 3.10.0-862.11.6.el7.x86_64
os: linux
uptime: 18h 38m 40.28s (Approximately 0.75 days)
insecure registries:
registries: []
registries:
registries:

  • docker.io
  • registry.centos.org
  • registry.access.redhat.com
    store:
    ContainerStore:
    number: 69
    GraphDriverName: overlay
    GraphOptions:
  • overlay.override_kernel_check=true
    GraphRoot: /var/lib/containers/storage
    GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    ImageStore:
    number: 28
    RunRoot: /var/run/containers/storage

Additional environment details (AWS, VirtualBox, physical, etc.):
Running in local vagrant (virtualbox provider)

@mheon
Copy link
Member

mheon commented Aug 24, 2018

Alright, so this is related to multiple filters being passed in at once. I'll take a look on Monday.

@EmilienM
Copy link
Contributor Author

@mheon right, when you pass multiple --filter, only the last one is actually processed.

@mheon mheon added the bug label Aug 24, 2018
@EmilienM
Copy link
Contributor Author

See https://docs.docker.com/engine/reference/commandline/ps/#options
The filtering flag (-f or --filter) format is a key=value pair. If there is more than one filter, then pass multiple flags (e.g. --filter "foo=bar" --filter "bif=baz")

@mheon
Copy link
Member

mheon commented Aug 24, 2018

The frontend code for ps currently assumes that --filter can only be passed once, and a comma-separated list of filters is passed. It should be simple to convert it to allow --filter to be passed multiple times instead (it's probably less code overall because we don't need to split the input on commas)

@mheon
Copy link
Member

mheon commented Aug 24, 2018

It ended up being simpler than I thought, so I hammered out a fix - #1345

@EmilienM
Copy link
Contributor Author

Closed-by #1345

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

2 participants