NAME¶ 名称
podman-restart - Restart one or more containers
podman-restart - 重新启动一个或多个容器
SYNOPSIS¶ 概要
podman restart [options] container …
podman restart [选项] 容器...
podman container restart [options] container …
podman 容器重新启动 [选项] 容器..
DESCRIPTION¶ 描述
The restart command allows containers to be restarted using their ID or name.
Running containers are stopped and restarted. Stopped containers are started.
重启命令允许使用其 ID 或名称重新启动容器。正在运行的容器将被停止并重新启动。已停止的容器将被启动。
OPTIONS¶ 选项
--all, -a¶
Restart all containers regardless of their current state.
重新启动所有容器,无论其当前状态如何。
--cidfile¶
Read container ID from the specified file and restart the container. Can be specified multiple times.
从指定文件中读取容器 ID 并重新启动容器。可以多次指定。
--filter, -f=filter¶ --filter, -f=过滤器 ¶
Filter what containers restart.
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. |
--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)主机)
--running¶ --运行 ¶
Restart all containers that are already in the running state.
重新启动所有已处于运行状态的容器。
--time, -t=seconds¶ --time, -t=秒数
Seconds to wait before forcibly stopping the container.
Use -1 for infinite wait.
强制停止容器之前等待的秒数。使用 -1 表示无限等待。
EXAMPLES¶ 示例
Restart the latest container.
重新启动最新的容器。
$ podman restart -l
ec588fc80b05e19d3006bf2e8aa325f0a2e2ff1f609b7afb39176ca8e3e13467
Restart a specific container by partial container ID.
通过部分容器 ID 重新启动特定容器。
$ podman restart ff6cf1
ff6cf1e5e77e6dba1efc7f3fcdb20e8b89ad8947bc0518be1fcb2c78681f226f
Restart two containers by name with a timeout of 4 seconds.
通过名称重新启动两个容器,超时时间为 4 秒。
$ podman restart --time 4 test1 test2
c3bb026838c30e5097f079fa365c9a4769d52e1017588278fa00d5c68ebc1502
17e13a63081a995136f907024bcfe50ff532917988a152da229db9d894c5a9ec
Restart all running containers.
重新启动所有正在运行的容器。
$ podman restart --running
Restart all containers. 重新启动所有容器。
$ podman restart --all
Restart container using ID specified in a given files.
使用给定文件中指定的 ID 重新启动容器。
$ podman restart --cidfile /home/user/cidfile-1
$ podman restart --cidfile /home/user/cidfile-1 --cidfile ./cidfile-2
SEE ALSO¶ 参见 ¶
HISTORY¶ 历史 ¶
March 2018, Originally compiled by Matt Heon mheon@redhat.com
2018 年 3 月,最初由 Matt Heon mheon@redhat.com 编写