2020-10-14 21:19:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
ls -la
|
|
|
|
|
2021-09-06 08:45:11 +00:00
|
|
|
if ! crun checkpoint --help; then
|
|
|
|
echo "crun doesn't support checkpoint/restore"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-04-25 17:21:41 +00:00
|
|
|
rpm -q crun podman criu
|
|
|
|
|
2021-05-05 16:10:09 +00:00
|
|
|
echo "Start container"
|
|
|
|
podman --log-level debug run -d quay.io/adrianreber/counter
|
2020-10-14 21:19:34 +00:00
|
|
|
|
|
|
|
echo "See which containers are running"
|
|
|
|
podman ps
|
|
|
|
|
2021-05-05 16:10:09 +00:00
|
|
|
echo "Connect to the container"
|
|
|
|
curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088
|
2020-10-14 21:19:34 +00:00
|
|
|
|
2023-04-25 17:21:41 +00:00
|
|
|
CTR_ID=$(podman inspect -l --format '{{.Id}}')
|
|
|
|
|
2020-10-14 21:19:34 +00:00
|
|
|
echo "Checkpoint container"
|
|
|
|
podman --log-level debug container checkpoint -l
|
|
|
|
|
|
|
|
podman ps -a
|
|
|
|
echo "Restore container"
|
2023-04-25 17:21:41 +00:00
|
|
|
podman --log-level debug container restore "$CTR_ID"
|
2020-10-14 21:19:34 +00:00
|
|
|
|
|
|
|
podman ps -a
|
|
|
|
echo "Check if we can connect to the restored container"
|
2021-05-05 16:10:09 +00:00
|
|
|
curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088
|
2020-10-14 21:19:34 +00:00
|
|
|
|
|
|
|
ls -la
|