mirror of
https://github.com/containers/podman.git
synced 2026-10-28 12:49:41 -04:00
`podman wait --condition=exited` (and `=stopped`) returns immediately with exit code 0 for a container that was created but never started. This matches Docker's `not-running` semantics, but leaves no way to block until the container has actually run and exited. Move the Docker wait conditions from the compat API into libpod, so that they are available to the CLI and the libpod REST API, and let the compat handler use them instead of its own implementation: * next-exit: wait for the next "died" event regardless of the current state and return its exit code. Like Docker, removal also ends the wait * not-running: the same as exited * removed: wait until the container has been removed and return its exit code, or 0 if it never ran The docker compat handler uses the new `ready` callback in `WaitForConditionWithInterval` to send its headers to keep the fix for #28514 Behavior changes of the compat API: * not-running on a never-started container now always returns 0, before they could ping-pong between -1 and 0 * next-exit returns when the container is removed, instead of blocking forever, and fails if the event stream ends without a died event * removed polls the container state at the wait interval Fixes: #27423 Co-authored-by: Jan Rodák <hony.com@seznam.cz> Co-authored-by: Tom Sweeney <tsweeney@redhat.com> Signed-off-by: Dan Čermák <dcermak@suse.com> Assisted-by: Claude Opus 5.5 Assisted-by: Gemini 4 Argon