NAME¶ 名称
podman-container-restore - Restore one or more containers from a checkpoint
podman-container-restore - 从检查点中恢复一个或多个容器
SYNOPSIS¶ 概要
podman container restore [options] name […]
podman container restore [选项] 名称 […]
DESCRIPTION¶ 描述
podman container restore restores a container from a container checkpoint or
checkpoint image. The container IDs, image IDs or names are used as input.
podman container restore 从容器检查点或检查点镜像中恢复容器。容器 ID、镜像 ID 或名称被用作输入。
OPTIONS¶ 选项
--all, -a¶
Restore all checkpointed containers.
恢复所有已检查点的容器。
The default is false.
默认值为 false。
IMPORTANT: This OPTION does not need a container name or ID as input argument.
重要提示:此选项不需要容器名称或 ID 作为输入参数。
--file-locks¶
Restore a container with file locks. This option is required to
restore file locks from a checkpoint image. If the checkpoint image
does not contain file locks, this option is ignored. Defaults to not
restoring file locks.
使用文件锁恢复容器。此选项用于从检查点镜像中恢复文件锁。如果检查点镜像不包含文件锁,则此选项将被忽略。默认情况下不恢复文件锁。
The default is false.
默认值为 false。
--ignore-rootfs¶
If a container is restored from a checkpoint tar.gz file it is possible that it also contains all root file-system changes. With --ignore-rootfs it is possible to explicitly disable applying these root file-system changes to the restored container.
如果从检查点 tar.gz 文件中恢复容器,则可能还包含所有根文件系统更改。使用 --ignore-rootfs 可以显式禁用将这些根文件系统更改应用于恢复的容器。
The default is false.
默认值为 false。
IMPORTANT: This OPTION is only available in combination with --import, -i.
重要提示:此选项仅在与 --import, -i 结合使用时才可用。
--ignore-static-ip¶
If the container was started with --ip the restored container also tries to use that
IP address and restore fails if that IP address is already in use. This can happen, if
a container is restored multiple times from an exported checkpoint with --name, -n.
如果容器是使用 --ip 启动的,则恢复的容器也会尝试使用该 IP 地址,如果该 IP 地址已被使用,则恢复将失败。如果一个容器使用 --name, -n 从导出的检查点多次恢复,则可能会发生这种情况。
Using --ignore-static-ip tells Podman to ignore the IP address if it was configured
with --ip during container creation.
使用 --ignore-static-ip 告诉 Podman 在容器创建过程中忽略使用 --ip 配置的 IP 地址。
The default is false. 默认值为 false。
--ignore-static-mac¶
If the container was started with --mac-address the restored container also
tries to use that MAC address and restore fails if that MAC address is already
in use. This can happen, if a container is restored multiple times from an
exported checkpoint with --name, -n.
如果容器是使用 --mac-address 启动的,则恢复的容器也会尝试使用该 MAC 地址,如果该 MAC 地址已被使用,则恢复将失败。如果一个容器使用 --name, -n 从导出的检查点多次恢复,这种情况可能发生。
Using --ignore-static-mac tells Podman to ignore the MAC address if it was
configured with --mac-address during container creation.
使用 --ignore-static-mac 告诉 Podman 在容器创建过程中忽略 MAC 地址,如果它是通过 --mac-address 配置的。
The default is false. 默认值为 false。
--ignore-volumes¶
This option must be used in combination with the --import, -i option.
When restoring containers from a checkpoint tar.gz file with this option,
the content of associated volumes are not restored.
此选项必须与 --import, -i 选项结合使用。使用此选项从检查点 tar.gz 文件中还原容器时,相关卷的内容不会被还原。
The default is false.
默认值为 false。
--import, -i=file¶
Import a checkpoint tar.gz file, which was exported by Podman. This can be used
to import a checkpointed container from another host.
导入由 Podman 导出的检查点 tar.gz 文件。这可以用于从另一个主机导入一个已检查点的容器。
IMPORTANT: This OPTION does not need a container name or ID as input argument.
重要提示:此选项不需要容器名称或 ID 作为输入参数。
During the import of a checkpoint file Podman selects the same container runtime
which was used during checkpointing. This is especially important if a specific
(non-default) container runtime was specified during container creation. Podman
also aborts the restore if the container runtime specified during restore does
not much the container runtime used for container creation.
在导入检查点文件期间,Podman 选择与检查点期间使用的相同容器运行时。如果在容器创建期间指定了特定(非默认)的容器运行时,则这一点尤为重要。如果在恢复期间指定的容器运行时与用于容器创建的容器运行时不匹配,Podman 也会中止恢复。
--import-previous=file¶ --import-previous=file
Import a pre-checkpoint tar.gz file which was exported by Podman. This option
must be used with -i or --import. It only works on runc 1.0-rc3
or higher
.
IMPORTANT: This OPTION is not supported on the remote client, including Mac and Windows (excluding WSL2) machines.
导入由 Podman 导出的预检查点 tar.gz 文件。此选项必须与 -i 或 --import 一起使用。仅适用于 runc 1.0-rc3
或 higher
。重要提示:此选项不受远程客户端支持,包括 Mac 和 Windows(不包括 WSL2)机器。
--keep, -k¶
Keep all temporary log and statistics files created by CRIU
during
checkpointing as well as restoring. These files are not deleted if restoring
fails for further debugging. If restoring succeeds these files are
theoretically not needed, but if these files are needed Podman can keep the
files for further analysis. This includes the checkpoint directory with all
files created during checkpointing. The size required by the checkpoint
directory is roughly the same as the amount of memory required by the
processes in the checkpointed container.
在检查点期间以及恢复期间保留由 CRIU
创建的所有临时日志和统计文件。如果恢复失败,这些文件不会被删除,以便进行进一步调试。如果恢复成功,则理论上不需要这些文件,但如果这些文件需要,Podman 可以保留这些文件以供进一步分析。这包括检查点目录及其在检查点期间创建的所有文件。检查点目录所需的空间大致与检查点容器中进程所需的内存量相同。
Without the --keep, -k option, the checkpoint is consumed and cannot be used again.
没有 --keep、-k 选项,检查点将被消耗且无法再次使用。
The default is false.
默认值为 false。
--latest, -l¶
Instead of providing the container ID or name, use the last created container. The default is false.
IMPORTANT: This OPTION is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines. This OPTION does not need a container name or ID as input argument.
使用最后创建的容器,而不是提供容器的 ID 或名称。默认值为 false。重要提示:此选项在远程 Podman 客户端中不可用,包括 Mac 和 Windows(不包括 WSL2)机器。此选项不需要容器名称或 ID 作为输入参数。
--name, -n=name¶
If a container is restored from a checkpoint tar.gz file it is possible to rename it with --name, -n. This way it is possible to restore a container from a checkpoint multiple times with different
names.
如果从一个检查点 tar.gz 文件中恢复容器,可以使用 --name, -n 来重命名它。这样可以多次使用不同名称从检查点恢复容器。
If the --name, -n option is used, Podman does not attempt to assign the same IP
address to the container it was using before checkpointing as each IP address can only
be used once, and the restored container has another IP address. This also means
that --name, -n cannot be used in combination with --tcp-established.
如果使用了 --name, -n 选项,Podman 不会尝试将相同的 IP 地址分配给容器,因为每个 IP 地址只能使用一次,恢复的容器会有另一个 IP 地址。这也意味着 --name, -n 不能与 --tcp-established 结合使用。
IMPORTANT: This OPTION is only available for a checkpoint image or in combination
with --import, -i.
重要提示:此选项仅适用于检查点镜像或与 --import, -i 结合使用。
--pod=name¶ --pod=名称 ¶
Restore a container into the pod name. The destination pod for this restore
has to have the same namespaces shared as the pod this container was checkpointed
from (see podman pod create --share).
将容器还原到 pod 名称中。此还原的目标 pod 必须与此容器所在的 pod 共享相同的命名空间(请参阅 podman pod create --share)。
IMPORTANT: This OPTION is only available for a checkpoint image or in combination
with --import, -i.
重要提示:此选项仅适用于检查点镜像或与 --import, -i 结合使用。
This option requires at least CRIU 3.16.
此选项至少需要 CRIU 3.16。
--print-stats¶ --打印统计信息 ¶
Print out statistics about restoring the container(s). The output is
rendered in a JSON array and contains information about how much time different
restore operations required. Many of the restore statistics are created
by CRIU and just passed through to Podman. The following information is provided
in the JSON array:
打印有关恢复容器的统计信息。输出以 JSON 数组的形式呈现,并包含有关不同恢复操作所需时间的信息。许多恢复统计信息由 CRIU 创建,并仅传递给 Podman。JSON 数组中提供以下信息:
podman_restore_duration: Overall time (in microseconds) needed to restore all checkpoints.
podman_restore_duration: 恢复所有检查点所需的总时间(以微秒为单位)。runtime_restore_duration: Time (in microseconds) the container runtime needed to restore the checkpoint.
运行恢复持续时间:容器运行时需要恢复检查点的时间(以微秒为单位)。forking_time: Time (in microseconds) CRIU needed to create (fork) all processes in the restored container (measured by CRIU).
分叉时间:CRIU 需要创建(分叉)恢复容器中的所有进程所需的时间(由 CRIU 测量)(以微秒为单位)。restore_time: Time (in microseconds) CRIU needed to restore all processes in the container (measured by CRIU).
恢复时间:CRIU 需要恢复容器中的所有进程所需的时间(由 CRIU 测量)(以微秒为单位)。pages_restored: Number of memory pages restored (measured by CRIU).
恢复的页面数:由 CRIU 测量的内存页面数量。
The default is false. 默认值为 false。
--publish, -p=port¶
Replaces the ports that the container publishes, as configured during the
initial container start, with a new set of port forwarding rules.
用新的端口转发规则替换容器在初始容器启动期间配置的发布的端口。
For more details, see podman run --publish.
有关更多详细信息,请参阅 podman run --publish。
--tcp-established¶
Restore a container with established TCP connections. If the checkpoint image
contains established TCP connections, this option is required during restore.
If the checkpoint image does not contain established TCP connections this
option is ignored. Defaults to not restoring containers with established TCP
connections.
恢复具有已建立 TCP 连接的容器。如果检查点镜像包含已建立的 TCP 连接,则在恢复过程中需要此选项。如果检查点镜像不包含已建立的 TCP 连接,则将忽略此选项。默认情况下不恢复具有已建立 TCP 连接的容器。
The default is false.
默认值为 false。
EXAMPLE¶ 例子 ¶
Restore the container “mywebserver”.
恢复容器“mywebserver”。
# podman container restore mywebserver
Import a checkpoint file and a pre-checkpoint file.
导入一个检查点文件和一个预检查点文件。
# podman container restore --import-previous pre-checkpoint.tar.gz --import checkpoint.tar.gz
Start the container “mywebserver”. Make a checkpoint of the container and export it. Restore the container with other port ranges from the exported file.
启动容器“mywebserver”。对容器进行检查点并导出。使用导出文件中的其他端口范围恢复容器。
$ podman run --rm -p 2345:80 -d webserver
# podman container checkpoint -l --export=dump.tar
# podman container restore -p 5432:8080 --import=dump.tar
Start a container with the name “foobar-1”. Create a checkpoint image “foobar-checkpoint”. Restore the container from the checkpoint image with a different name.
使用名称“foobar-1”启动一个容器。创建一个检查点镜像“foobar-checkpoint”。使用不同名称从检查点镜像中恢复容器。
# podman run --name foobar-1 -d webserver
# podman container checkpoint --create-image foobar-checkpoint foobar-1
# podman inspect foobar-checkpoint
# podman container restore --name foobar-2 foobar-checkpoint
# podman container restore --name foobar-3 foobar-checkpoint
SEE ALSO¶ 参见 ¶
podman(1), podman-container-checkpoint(1), podman-run(1), podman-pod-create(1), criu(8)
HISTORY¶ 历史 ¶
September 2018, Originally compiled by Adrian Reber areber@redhat.com
2018 年 9 月,最初由 Adrian Reber areber@redhat.com 编译。