Skip to content

libpod: accept "dead" and "restarting" in container status filter#28932

Closed
amarkdotdev wants to merge 1 commit into
podman-container-tools:mainfrom
amarkdotdev:fix/container-state-filter-dead-restarting
Closed

libpod: accept "dead" and "restarting" in container status filter#28932
amarkdotdev wants to merge 1 commit into
podman-container-tools:mainfrom
amarkdotdev:fix/container-state-filter-dead-restarting

Conversation

@amarkdotdev

Copy link
Copy Markdown

Does this PR fix an issue?

Fixes #28904

Description

The API documentation states that the status filter accepts dead and restarting (matching Docker API behavior), but StringToContainerStatus did not recognize these values, returning a 500 error with unknown container state.

Changes

Add Docker-compatible aliases in libpod/define/containerstate.go:

  • "dead"ContainerStateExited (Docker uses "dead" for containers that failed to be removed)
  • "restarting"ContainerStateStopping (Podman has no dedicated restarting state; stopping is the closest equivalent)

How to verify

curl --unix-socket /run/podman/podman.sock "http://d/v5/libpod/containers/json?filters={%22status%22:[%22dead%22]}"
# Should return [] instead of 500 error

The API documentation states that status filter accepts "dead" and
"restarting" (matching Docker API behavior), but
StringToContainerStatus did not recognize these values, returning
"unknown container state" errors.

Add Docker-compatible aliases:
- "dead" maps to ContainerStateExited (Docker uses "dead" for
  containers that failed to be removed)
- "restarting" maps to ContainerStateStopping (Podman does not have
  a dedicated restarting state; stopping is the closest equivalent)

Fixes podman-container-tools#28904

Signed-off-by: amarkdotdev <amarkdotdev@users.noreply.github.com>
Signed-off-by: amarkdotdev <64331623+amarkdotdev@users.noreply.github.com>
@amarkdotdev

Copy link
Copy Markdown
Author

Closing this PR. Podman's LLM policy requires that contributions be written and described by the human author in their own words, and this PR was prepared with AI assistance that did not meet that bar. I will not resubmit unless I can do so in line with the policy. Apologies for the noise.

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