docker checkpoint (original) (raw)

Description Manage checkpoints
Usage docker checkpoint

Experimental

This command is experimental.

Experimental features are intended for testing and feedback as their functionality or design may change between releases without warning or can be removed entirely in a future release.

Checkpoint and Restore is an experimental feature that allows you to freeze a running container by specifying a checkpoint, which turns the container state into a collection of files on disk. Later, the container can be restored from the point it was frozen.

This is accomplished using a tool calledCRIU, which is an external dependency of this feature. A good overview of the history of checkpoint and restore in Docker is available in thisKubernetes blog post.

Installing CRIU

If you use a Debian system, you can add the CRIU PPA and install with apt-get from the CRIU launchpad.

Alternatively, you canbuild CRIU from source.

You need at least version 2.0 of CRIU to run checkpoint and restore in Docker.

Use cases for checkpoint and restore

This feature is currently focused on single-host use cases for checkpoint and restore. Here are a few:

Another primary use case of checkpoint and restore outside of Docker is the live migration of a server from one machine to another. This is possible with the current implementation, but not currently a priority (and so the workflow is not optimized for the task).

Using checkpoint and restore

A new top level command docker checkpoint is introduced, with three subcommands:

Additionally, a --checkpoint flag is added to the docker container start command.

The options for docker checkpoint create:

And to restore a container:

Example of using checkpoint and restore on a container:

This process just logs an incrementing counter to stdout. If you run docker logsin-between running/checkpoint/restoring, you should see that the counter increases while the process is running, stops while it's frozen, and resumes from the point it left off once you restore.

Known limitations

seccomp is only supported by CRIU in very up-to-date kernels.

External terminals (i.e. docker run -t ..) aren't supported. If you try to create a checkpoint for a container with an external terminal, it fails:

Command Description
docker checkpoint create Create a checkpoint from a running container
docker checkpoint ls List checkpoints for a container
docker checkpoint rm Remove a checkpoint