Explanation: The command lxc-checkpoint is used to checkpoint and restore containers. Checkpointing a container means saving the state of the container, including its memory, processes, file descriptors, and network connections, to a file or a directory. Restoring a container means resuming the container from the saved state, as if it was never stopped. Checkpointing and restoring containers can be useful for various purposes, such as live migration, backup, debugging, or snapshotting. The command lxc-checkpoint has the following syntax:
lxc-checkpoint {-n name} {-D path} [-r] [-s] [-v] [-d] [-F]
The options are:
- -n name: Specify the name of the container to checkpoint or restore.
- -D path: Specify the path to the file or directory where the checkpoint data is dumped or restored.
- -r, --restore: Restore the checkpoint for the container, instead of dumping it. This option is incompatible with -s.
- -s, --stop: Optionally stop the container after dumping. This option is incompatible with -r.
- -v, --verbose: Enable verbose criu logging. Only available when providing -r.
- -d, --daemon: Restore the container in the background (this is the default). Only available when providing -r.
- -F, --foreground: Restore the container in the foreground. Only available when providing -r.
The command lxc-checkpoint uses the CRIU (Checkpoint/Restore In Userspace) tool to perform the checkpoint and restore operations. CRIU is a software that can freeze a running application (or part of it) and checkpoint it to a hard drive as a collection of files. It can then use the files to restore and run the application from the point it was frozen at1.
The other statements about the command lxc-checkpoint are not correct. It does not create a clone or an image of a container, nor does it double the memory consumptionof the container. It can work on both running and stopped containers, depending on the options provided. References:
- Linux Containers - LXC - Manpages - lxc-checkpoint.12
- lxc-checkpoint(1) - Linux manual page - man7.org3
- CRIU4