NAME¶ 名称
podman-stop - Stop one or more running containers
podman-stop - 停止一个或多个正在运行的容器
SYNOPSIS¶ 概要
podman stop [options] container …
podman stop [选项] 容器...
podman container stop [options] container …
podman 容器停止 [选项] 容器..
DESCRIPTION¶ 描述
Stops one or more containers using container IDs or names as input. The --time option
specifies the number of seconds to wait before forcibly stopping the container after the stop command
is issued to the container. The default is 10 seconds. By default, containers are stopped with SIGTERM
and then SIGKILL after the timeout. The SIGTERM default can be overridden by the image used to create the
container and also via command line when creating the container.
使用容器 ID 或名称停止一个或多个容器。--time 选项指定在向容器发出停止命令后强制停止容器之前等待的秒数。默认值为 10 秒。默认情况下,容器在超时后使用 SIGTERM 停止,然后使用 SIGKILL。 SIGTERM 默认值可以通过用于创建容器的镜像和创建容器时的命令行进行覆盖。
OPTIONS¶ 选项
--all, -a¶
Stop all running containers. This does not include paused containers.
停止所有正在运行的容器。这不包括暂停的容器。
--cidfile=file¶
Read container ID from the specified file and stop the container.
Can be specified multiple times.
从指定文件中读取容器 ID 并停止容器。可以多次指定。
Command does not fail when file is missing and user specified --ignore.
当文件丢失并且用户指定了 --ignore 时,命令不会失败。
--filter, -f=filter¶ --filter, -f=过滤器 ¶
Filter what containers are going to be stopped.
Multiple filters can be given with multiple uses of the --filter flag.
Filters with the same key work inclusive with the only exception being
label
which is exclusive. Filters with different keys always work exclusive.
过滤要停止的容器。可以使用多个 --filter 标志来提供多个过滤器。具有相同键的过滤器与唯一例外 label
一起包容工作。具有不同键的过滤器始终是互斥的。
Valid filters are listed below:
下面列出了有效的过滤器:
Filter |
Description |
---|---|
id |
[ID] Container’s ID (CID prefix match by default; accepts regex) |
name |
[Name] Container’s name (accepts regex) |
label |
[Key] or [Key=Value] Label assigned to a container |
exited |
[Int] Container’s exit code |
status |
[Status] Container’s status: ‘created’, ‘exited’, ‘paused’, ‘running’, ‘unknown’ |
ancestor |
[ImageName] Image or descendant used to create container |
before |
[ID] or [Name] Containers created before this container |
since |
[ID] or [Name] Containers created since this container |
volume |
[VolumeName] or [MountpointDestination] Volume mounted in container |
health |
[Status] healthy or unhealthy |
pod |
[Pod] name or full or partial ID of pod |
network |
[Network] name or full ID of network |
until |
[DateTime] Containers created before the given duration or time. |
--ignore, -i¶
Ignore errors when specified containers are not in the container store. A user
might have decided to manually remove a container which leads to a failure
during the ExecStop directive of a systemd service referencing that container.
当指定的容器不在容器存储中时忽略错误。用户可能已经决定手动删除一个容器,这会导致在引用该容器的 systemd 服务的 ExecStop 指令期间失败。
--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)主机)
--time, -t=seconds¶ --time, -t=秒数
Seconds to wait before forcibly stopping the container.
Use -1 for infinite wait.
强制停止容器之前等待的秒数。使用 -1 表示无限等待。
EXAMPLES¶ 示例
Stop the specified container via its name.
通过名称停止指定的容器。
$ podman stop mywebserver
Stop the container via its id.
通过其 ID 停止容器。
$ podman stop 860a4b235279
Stop multiple containers.
停止多个容器。
$ podman stop mywebserver 860a4b235279
Stop the container identified in the cidfile.
停止在 cidfile 中标识的容器。
$ podman stop --cidfile /home/user/cidfile-1
Stop the containers identified in the cidfiles.
停止在 cidfiles 中标识的容器。
$ podman stop --cidfile /home/user/cidfile-1 --cidfile ./cidfile-2
Stop the specified container in 2 seconds.
在 2 秒内停止指定的容器。
$ podman stop --time 2 860a4b235279
Stop all running containers.
停止所有正在运行的容器。
$ podman stop -a
Stop the last created container (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
停止最后创建的容器(此选项不适用于远程 Podman 客户端,包括 Mac 和 Windows(不包括 WSL2)机器)。
$ podman stop --latest
SEE ALSO¶ 参见 ¶
HISTORY¶ 历史 ¶
September 2018, Originally compiled by Brent Baude bbaude@redhat.com
2018 年 9 月,最初由 Brent Baude bbaude@redhat.com 编译