libpod: add next-exit/not-running/removed wait conditions (fixes #27423)#28976
Open
dcermak wants to merge 1 commit into
Open
libpod: add next-exit/not-running/removed wait conditions (fixes #27423)#28976dcermak wants to merge 1 commit into
dcermak wants to merge 1 commit into
Conversation
Honny1
requested changes
Jun 22, 2026
Honny1
left a comment
Contributor
There was a problem hiding this comment.
Thanks, I have some comments.
| }() | ||
| } | ||
|
|
||
| if waitForNextExit { |
Contributor
There was a problem hiding this comment.
I think these wait logics are implemented in compat API pkg/api/handlers/utils/containers.go (waitNextExit, waitNotRunning, waitRemoved). I would reuse them.
| // regardless of the container's current state. This differs from | ||
| // "exited"/"stopped", which return immediately for a container that | ||
| // has never been started. | ||
| ContainerWaitConditionNextExit = "next-exit" |
Contributor
There was a problem hiding this comment.
Why not use ContainerStatus type?
…an-container-tools#27423) `podman wait --condition=exited` (and `=stopped`) returns immediately with exit code 0 for a container that has been created but never started. This matches Docker's `not-running` default semantic, a container that has never run is, by definition, not running. But that leaves users with no way to express "block until the container has actually been started and has exited" Expose the Docker-style condition aliases at the libpod wait API and CLI: * next-exit: subscribe to died events and block until the container's next exit, regardless of current state. Returns the real exit code * not-running: match any non-running sub-state. Delegates to WaitForExit so the real exit code (or 0 for a never-started container) is returned * removed: block until the container has been removed, returning the recorded exit code Fixes: podman-container-tools#27423 Co-authored-by: Jan Rodák <hony.com@seznam.cz> Signed-off-by: Dan Čermák <dcermak@suse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
podman wait --condition=exited(and=stopped) returns immediately with exit code 0 for a container that has been created but never started. This matches Docker'snot-runningdefault semantic, a container that has never run is, by definition, not running. But that leaves users with no way to express "block until the container has actually been started and has exited"Expose the Docker-style condition aliases at the libpod wait API and CLI:
Fixes: #27423
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?