Changes

2,762 bytes added ,  12:55, 1 May 2022
no edit summary
Line 61: Line 61:  
* https://asciinema.org/a/249918
 
* https://asciinema.org/a/249918
 
* https://asciinema.org/a/249922
 
* https://asciinema.org/a/249922
 +
 +
== Checkpoint Images ==
 +
 +
In addition to the standard checkpoint/restore functionality described above, Podman supports checkpoint images to enable container migration across multiple systems with standard image distribution infrastructure (container registry).
 +
 +
A checkpoint image can be created with the <code>--create-image <image></code> option <code>podman container checkpoint</code>. This option instructs Podman to create a standard OCI container image with a single layer that contains all checkpoint files.
 +
 +
Example:
 +
 +
# podman run -d --name looper busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
 +
# podman container checkpoint --create-image checkpoint-image-1 looper
 +
 +
You can verify that the image has been created as follows:
 +
 +
# podman image ls
 +
 +
You can restore a container from checkpoint image as follows:
 +
 +
# podman container restore <image>
 +
 +
Example:
 +
 +
# podman container restore checkpoint-image-1
 +
 +
Note that creating a checkpoint would not remove the container and it is not possible to have two containers with the same name. Thus, it might be necessary to restore the container with a different name:
 +
 +
# podman container restore --name looper-2 checkpoint-image-1
 +
 +
Or to remove the existing container before restore:
 +
 +
# podman rm looper
 +
 +
A checkpoint image can be pushed to a container registry:
 +
 +
# podman login quay.io
 +
# podman container checkpoint --create-image quay.io/rst0git/checkpoint-image-test-1 looper
 +
# podman push quay.io/rst0git/checkpoint-image-test-1
 +
 +
The content of the image layer is in the same format as a checkpoint archive created with the <code>--export</code> option.
 +
This allows to be exported locally with <code>podman image save</code> and restored with the <code>--import</code> option.
 +
 +
In addition, checkpoint images can be inspected with <code>podman inspect</code>. Inspecting a checkpoint image would display additional information, stored as annotations, about the host environment used to do the checkpoint.
 +
 +
And pulled and restored on a different system:
 +
 +
# podman pull quay.io/rst0git/checkpoint-image-test-1
 +
# podman container restore quay.io/rst0git/checkpoint-image-test-1
 +
# podman inspect quay.io/rst0git/checkpoint-image-test-1
 +
 +
Restoring multiple containers at the same time can be achieved as follows:
 +
 +
# podman run -d --name looper-1 busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
 +
# podman run -d --name looper-2 busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
 +
# podman container checkpoint --create-image checkpoint-1 looper-1
 +
# podman container checkpoint --create-image checkpoint-2 looper-2
 +
# podman rm looper-1 looper-2
 +
# podman container restore checkpoint-1 checkpoint-2
332

edits