NAME 名称

podman-wait - Wait on one or more containers to stop and print their exit codes
podman-wait - 等待一个或多个容器停止并打印它们的退出代码

SYNOPSIS 概要

podman wait [options] container […]
podman wait [选项] 容器 […]

podman container wait [options] container […]
podman 容器等待 [选项] 容器 […]

DESCRIPTION 描述

Waits on one or more containers to stop. The container can be referred to by its name or ID. In the case of multiple containers, Podman waits on each consecutively. After all conditions are satisfied, the containers’ return codes are printed separated by newline in the same order as they were given to the command. An exit code of -1 is emitted for all conditions other than “stopped” and “exited”.
等待一个或多个容器停止。容器可以通过其名称或 ID 引用。在多个容器的情况下,Podman 依次等待每个容器。在满足所有条件之后,容器的返回代码按照给定命令的顺序以换行符分隔打印出来。除了“stopped”和“exited”之外的所有条件都会发出退出码为-1 的信号。

NOTE: there is an inherent race condition when waiting for containers with a restart policy of always or on-failure, such as those created by podman kube play. Such containers may be repeatedly exiting and restarting, possibly with different exit codes, but podman wait can only display and detect one.
注意: 当等待具有重启策略为 alwayson-failure 的容器时存在固有的竞争条件,例如由 podman kube play 创建的容器。这些容器可能会重复退出和重启,可能具有不同的退出代码,但 podman wait 只能显示和检测一个。

OPTIONS 选项

--condition=state --condition=state

Container state or condition to wait for. Can be specified multiple times where at least one condition must match for the command to return. Supported values are “configured”, “created”, “exited”, “healthy”, “initialized”, “paused”, “removing”, “running”, “stopped”, “stopping”, “unhealthy”. The default condition is “stopped”.
等待的容器状态或条件。可以多次指定,其中至少一个条件必须匹配才能返回命令。支持的值为“configured”、“created”、“exited”、“healthy”、“initialized”、“paused”、“removing”、“running”、“stopped”、“stopping”、“unhealthy”。默认条件为“stopped”。

--help, -h --help,-h ¶

Print usage statement 打印使用说明

--ignore

Ignore errors when a specified container is missing and mark its return code as -1.
当指定的容器丢失时忽略错误,并将其返回代码标记为-1。

--interval, -i=duration
--interval,-i=持续时间 ¶

Time interval to wait before polling for completion. A duration string is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”. Time unit defaults to “ms”.
等待完成之前等待的时间间隔。持续时间字符串是一系列十进制数,每个数都带有可选的小数部分和单位后缀,例如“300ms”,“-1.5h”或“2h45m”。有效的时间单位为“ns”,“us”(或“µs”),“ms”,“s”,“m”,“h”。时间单位默认为“ms”。

--latest, -l

Instead of providing the container name or ID, use the last created container. Note: the last started container can be from other users of Podman on the host machine. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
不要提供容器名称或 ID,而是使用最后创建的容器。注意:最后启动的容器可能来自主机上其他 Podman 用户。(此选项在远程 Podman 客户端中不可用,包括 Mac 和 Windows(不包括 WSL2)主机)

EXAMPLES 示例

Wait for the specified container to exit.
等待指定容器退出。

$ podman wait mywebserver
0

Wait for the latest container to exit. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
等待最新容器退出。(此选项在远程 Podman 客户端中不可用,包括 Mac 和 Windows(不包括 WSL2)机器)

$ podman wait --latest
0

Wait for the container to exit, checking every two seconds.
等待容器退出,每两秒检查一次。

$ podman wait --interval 2s mywebserver
0

Wait for the container by ID. This container exits with error status 1:
按 ID 等待容器。该容器以错误状态 1 退出:

$ podman wait 860a4b23
1

Wait for both specified containers to exit.
等待两个指定的容器都退出。

$ podman wait mywebserver myftpserver
0
125

Wait for the named container to exit, but do not fail if the container does not exist.
等待指定的容器退出,但如果容器不存在则不会失败。

$ podman wait --ignore does-not-exist
-1

SEE ALSO 参见 ¶

podman(1)

HISTORY 历史 ¶

September 2017, Originally compiled by Brent Baudebbaude@redhat.com
2017 年 9 月,最初由 Brent Baudebbaude@redhat.com 编译。