How do we take container snapshots and load the snapshot in another docker host . I like to know the container snapshoting and not for image. I get confused with export/import a
If you're looking for an "exact state", including the execution state, you may need to use CRIU (checkpoint).
Given a linux host machine, Docker can use CRIU to save the execution state of the container. CRIU is still "experimental", and you can see all the possible commands (after enabling experimental mode) by running:
docker checkpoint
You can use the --save-dir
option to put the checkpoint in the directory of your choosing.
You can then use
docker start --checkpoint (checkpoint name) --checkpoint-dir (checkpoint directory)
to restore the checkpoint.
If moving servers, you may need to bring the image along with you.
You can read more on the docs: https://docs.docker.com/engine/reference/commandline/checkpoint/