Skip to content

podman events: Support label filter with key only #26702

@Tarow

Description

@Tarow

Feature request description

When using podman events one can specify a label filter.
The filter has to explicitly contain the label key as well as the label value to get the events, e.g. for a container.
This does not allow filtering for events, where the label key is known but the value isn't. E.g. filter all events with key foo, no matter what the value is.

This can be reproduced like this:

  1. Listen to all events with label key foo: podman events --filter label="foo"
  2. Start a container with the label: podman run --label "foo=bar" --rm --name echo docker.io/ealen/echo-server

In this case, no event is received.

On the other hand, when explicitly stating key and value like this:

  1. podman events --filter label="foo=bar"
  2. podman run --label "foo=bar" --rm --name echo docker.io/ealen/echo-server

the container start and stop events are shown.


Other commands like podman container ls do seem to support the label key only syntax:

podman container ls --filter label="foo"

will list the container.

Suggest potential solution

podman events filter should behave the same as the podman container ls filter, e.g. when given only a label key, all resources should be returned with the given label key, no matter the label value.

Have you considered any alternatives?

No response

Additional context

This is a feature that is also supported by Dockers event filter, e.g. from their docs:

The currently supported filters are:

  • label (label=<key> or label=<key>=<value>)
  • [...]

Metadata

Metadata

Labels

Good First IssueThis issue would be a good issue for a first time contributor to undertake.bugweekkind/featureCategorizes issue or PR as related to a new feature.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.triagedIssue has been triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions