10 Commits

Author SHA1 Message Date
80639df27a podman wait: allow waiting for removal of containers
By default wait only waits for the exit of a container, there is really
no way to make it wait for the removal too when the container was
created with --rm. I though I found a clever way in 8a943311db but this
is not working race free. While it works most of the time any other
parallel process might call syncContainer() before the cleanup process
holds the lock until it removes it. As such the wait hack to only update
the state and not sync the exit file did not work so we can drop that.

However the test wants to wait for the removal to happen by the cleanup
process and we can already say --condition=removing to do this but this
will throw an error if the ctr was removed instead of counting this as
success so fix that as well.

Fixes #23640

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-16 15:44:02 +02:00
6fb10421fb docs: update podman-wait man page
Waiting now actually makes sure to exit on first container exit. Also
notice that it does not wait for --rm to have the container removed at
this point.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-15 13:32:41 +02:00
7dcbc75aa0 [CI:DOCS] minor man page cleanup
Followup to #21285. I hope this is easier to review
than a re-push of that one.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-01-25 15:59:18 -07:00
d3a49fdedb Add information about --latest support on man pages
On Mac and Windows systems the --latest option is not supported
this PR mentions this fact in the examples section of the man page.
Also added documentation and consistency to the man pages examples
sections.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-01-23 07:28:40 -05:00
1398cbce8a container wait: support health states
Support two new wait conditions, "healthy" and "unhealthy".  This
further paves the way for integrating sdnotify with health checks which
is currently being tracked in #6160.

Fixes: #13627
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-23 14:16:32 +02:00
64153ace05 podman wait: update man page
While reading the code I found the man page to be lacking some
information that I found worth mentioning and clarifying.
In particular, how the command behaves with respect to exit codes and
when more than one condition is specified.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-23 09:26:30 +02:00
1b9272a060 wait: look for exit code in stopped state
Make sure to look for the container's exit code when it's in stopped
state.  With `--restart=always`, the container seems to stay in the
stopped state which led the wait logic to loop until the 20 seconds
timeout for the cleanup process to have finished kicks in.

Also defensively make sure to loop when the container is in stopped
state but no exit code has been written yet.

Add a regression test to make sure Podman doesn't wait more than 20
seconds.  Even on a CI machine under high load I expect it to take much
much much less than that, so I do not expect this test to flake in the
future.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-05-22 14:53:19 +02:00
32c2cea0f9 Remove future tense from man pages
Remove all will, would, could, should and use present tense.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-05-16 15:10:33 -04:00
f4d0496b54 wait: add --ignore option
In the recent past, I met the frequent need to wait for a container to
exist that, at the same time, may get removed (e.g., system tests in [1]).

Add an `--ignore` option to podman-wait which will ignore errors when a
specified container is missing and mark its exit code as -1.  Also
remove ID fields from the WaitReport.  It is actually not used by
callers and removing it makes the code simpler and faster.

Once merged, we can go over the tests and simplify them.

[1] github.com/containers/podman/pull/16852

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-16 10:24:29 +01:00
7665bbc127 Remove 'you' from man pages
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-07 09:29:29 -05:00