1

Need to restart host os but how to save the state of the running containers and after the host system rebooted restore the containers from saved point?

1

1 Answer 1

2

Configure Docker for experimental options:

$ sudo nano /etc/docker/daemon.json

add

{
"experimental": true
}

Press CTRL+X, select Y and press Enter to save the new file.

or

$ sudo echo '{"experimental": true}' >> /etc/docker/daemon.json

restart the docker service:

$ sudo service docker restart

Check with

$ docker version

if experimental is indeed enabled.

Install CRIU package

$ sudo apt-get install criu

Try out simple scenario with Docker checkpoint on CRIU

docker run --security-opt=seccomp:unconfined --name cr -d busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'

check on the values:

docker logs cr

create a checkpoint for the container:

docker checkpoint create  --leave-running=true cr checkpoint0

leave the container running for a while and check the logs again

$ docker logs cr

now stop the container:

$ docker stop cr

and restart/recreate the container from the checkpoint:

docker start --checkpoint checkpoint0 cr

Check the logs:

docker logs cr

You will find that the log is resumed at the value where the checkpoint was created.

https://technology.amis.nl/2018/04/08/first-steps-with-docker-checkpoint-to-create-and-restore-snapshots-of-running-containers/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .