Skip to content

filters: accept Docker-compat status values "dead" and "restarting"#28906

Closed
crawfordxx wants to merge 1 commit into
podman-container-tools:mainfrom
crawfordxx:fix-status-filter-dead-restarting-28904
Closed

filters: accept Docker-compat status values "dead" and "restarting"#28906
crawfordxx wants to merge 1 commit into
podman-container-tools:mainfrom
crawfordxx:fix-status-filter-dead-restarting-28904

Conversation

@crawfordxx

Copy link
Copy Markdown
Contributor

The API documentation lists "dead" and "restarting" as valid status filter values, but both return a 500 error:

unknown container state: dead: invalid argument
unknown container state: restarting: invalid argument

Podman has no internal state equivalent to Docker's dead or restarting states, so containers will never match these filters. The fix is to accept them without error rather than reject the request — callers get an empty list instead of a 500.

The validation loop in GenerateContainerFilterFuncs now skips the StringToContainerStatus check for these two Docker-compat values. The filter closure itself needs no change since neither "dead" nor "restarting" will ever match a Podman container state string.

A bats test was added to 040-ps.bats to verify both values are accepted and return empty results.

Fixes #28904

The /libpod/containers/json (and compat) API documents "dead" and
"restarting" as valid status filter values (matching Docker's API), but
the implementation rejected them with:

  unknown container state: dead: invalid argument
  unknown container state: restarting: invalid argument

Podman has no internal state that maps to either Docker concept, so no
container will ever match these filters.  The correct behavior is to
accept the values without error and return an empty result set, rather
than a 500 error.

Fix the validation loop in GenerateContainerFilterFuncs to skip the
StringToContainerStatus check for these two Docker-compat values.

Fixes podman-container-tools#28904

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
@packit-as-a-service

Copy link
Copy Markdown

tmt tests failed for commit 9ed4d53. @lsm5, @psss, @thrix please check.

@crawfordxx

Copy link
Copy Markdown
Contributor Author

Superseded by #28926 which includes the same fix on the latest main branch.

@crawfordxx crawfordxx closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status filter does not accept "dead" and "restarting" in list containers podman API

1 participant