docs: move checkpoint/restore doc from experimental into reference

This allows this information to be read from docs.docker.com.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-08-23 17:41:23 +02:00
parent c758c3e4a5
commit aa89e6847a
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 39 additions and 28 deletions

View File

@ -1,6 +1,13 @@
# Docker Checkpoint & Restore ---
title: docker checkpoint
description: "The checkpoint command description and usage"
keywords: experimental, checkpoint, restore, criu
experimental: true
---
Checkpoint & Restore is a new feature that allows you to freeze a running ## Description
Checkpoint and Restore is an experimental feature that allows you to freeze a running
container by checkpointing it, which turns its state into a collection of files container by checkpointing it, which turns its state into a collection of files
on disk. Later, the container can be restored from the point it was frozen. on disk. Later, the container can be restored from the point it was frozen.
@ -9,16 +16,16 @@ external dependency of this feature. A good overview of the history of
checkpoint and restore in Docker is available in this checkpoint and restore in Docker is available in this
[Kubernetes blog post](https://kubernetes.io/blog/2015/07/how-did-quake-demo-from-dockercon-work/). [Kubernetes blog post](https://kubernetes.io/blog/2015/07/how-did-quake-demo-from-dockercon-work/).
## Installing CRIU ### Installing CRIU
If you use a Debian system, you can add the CRIU PPA and install with apt-get If you use a Debian system, you can add the CRIU PPA and install with apt-get
[from the criu launchpad](https://launchpad.net/~criu/+archive/ubuntu/ppa). [from the criu launchpad](https://launchpad.net/~criu/+archive/ubuntu/ppa).
Alternatively, you can [build CRIU from source](http://criu.org/Installation). Alternatively, you can [build CRIU from source](https://criu.org/Installation).
You need at least version 2.0 of CRIU to run checkpoint/restore in Docker. You need at least version 2.0 of CRIU to run checkpoint/restore in Docker.
## Use cases for checkpoint & restore ### Use cases for checkpoint & restore
This feature is currently focused on single-host use cases for checkpoint and This feature is currently focused on single-host use cases for checkpoint and
restore. Here are a few: restore. Here are a few:
@ -33,7 +40,7 @@ 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 current implementation, but not currently a priority (and so the workflow is
not optimized for the task). not optimized for the task).
## Using checkpoint & restore ### Using checkpoint & restore
A new top level command `docker checkpoint` is introduced, with three subcommands: A new top level command `docker checkpoint` is introduced, with three subcommands:
- `create` (creates a new checkpoint) - `create` (creates a new checkpoint)
@ -44,35 +51,40 @@ Additionally, a `--checkpoint` flag is added to the container start command.
The options for checkpoint create: The options for checkpoint create:
```console
Usage: docker checkpoint create [OPTIONS] CONTAINER CHECKPOINT Usage: docker checkpoint create [OPTIONS] CONTAINER CHECKPOINT
Create a checkpoint from a running container Create a checkpoint from a running container
--leave-running=false Leave the container running after checkpoint --leave-running=false Leave the container running after checkpoint
--checkpoint-dir Use a custom checkpoint storage directory --checkpoint-dir Use a custom checkpoint storage directory
```
And to restore a container: And to restore a container:
```console
Usage: docker start --checkpoint CHECKPOINT_ID [OTHER OPTIONS] CONTAINER Usage: docker start --checkpoint CHECKPOINT_ID [OTHER OPTIONS] CONTAINER
```
Example of using checkpoint & restore on a container:
A simple example of using checkpoint & restore on a container: ```console
$ 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' $ 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'
> abc0123 abc0123
$ docker checkpoint create cr checkpoint1 $ docker checkpoint create cr checkpoint1
# <later> # <later>
$ docker start --checkpoint checkpoint1 cr $ docker start --checkpoint checkpoint1 cr
> abc0123 abc0123
```
This process just logs an incrementing counter to stdout. If you `docker logs` This process just logs an incrementing counter to stdout. If you `docker logs`
in between running/checkpoint/restoring you should see that the counter in between running/checkpoint/restoring you should see that the counter
increases while the process is running, stops while it's checkpointed, and increases while the process is running, stops while it's checkpointed, and
resumes from the point it left off once you restore. resumes from the point it left off once you restore.
## Current limitation ### Known limitations
seccomp is only supported by CRIU in very up to date kernels. seccomp is only supported by CRIU in very up to date kernels.
@ -80,9 +92,10 @@ External terminal (i.e. `docker run -t ..`) is not supported at the moment.
If you try to create a checkpoint for a container with an external terminal, If you try to create a checkpoint for a container with an external terminal,
it would fail: it would fail:
```console
$ docker checkpoint create cr checkpoint1 $ docker checkpoint create cr checkpoint1
Error response from daemon: Cannot checkpoint container c1: rpc error: code = 2 desc = exit status 1: "criu failed: type NOTIFY errno 0\nlog file: /var/lib/docker/containers/eb62ebdbf237ce1a8736d2ae3c7d88601fc0a50235b0ba767b559a1f3c5a600b/checkpoints/checkpoint1/criu.work/dump.log\n" Error response from daemon: Cannot checkpoint container c1: rpc error: code = 2 desc = exit status 1: "criu failed: type NOTIFY errno 0\nlog file: /var/lib/docker/containers/eb62ebdbf237ce1a8736d2ae3c7d88601fc0a50235b0ba767b559a1f3c5a600b/checkpoints/checkpoint1/criu.work/dump.log\n"
$ cat /var/lib/docker/containers/eb62ebdbf237ce1a8736d2ae3c7d88601fc0a50235b0ba767b559a1f3c5a600b/checkpoints/checkpoint1/criu.work/dump.log $ cat /var/lib/docker/containers/eb62ebdbf237ce1a8736d2ae3c7d88601fc0a50235b0ba767b559a1f3c5a600b/checkpoints/checkpoint1/criu.work/dump.log
Error (mount.c:740): mnt: 126:./dev/console doesn't have a proper root mount Error (mount.c:740): mnt: 126:./dev/console doesn't have a proper root mount
```

View File

@ -11,8 +11,6 @@ please feel free to provide any feedback on these features you wish.
## Use Docker experimental ## Use Docker experimental
Experimental features are now included in the standard Docker binaries as of
version 1.13.0.
To enable experimental features, start the Docker daemon with the To enable experimental features, start the Docker daemon with the
`--experimental` flag or enable the daemon flag in the `--experimental` flag or enable the daemon flag in the
`/etc/docker/daemon.json` configuration file: `/etc/docker/daemon.json` configuration file:
@ -39,5 +37,5 @@ Checkpoint and restore support for Containers.
Metrics (Prometheus) output for basic container, image, and daemon operations. Metrics (Prometheus) output for basic container, image, and daemon operations.
* [External graphdriver plugins](../docs/extend/plugins_graphdriver.md) * [External graphdriver plugins](../docs/extend/plugins_graphdriver.md)
* [Checkpoint & Restore](checkpoint-restore.md) * [Checkpoint & Restore](../docs/reference/commandline/checkpoint-restore.md)
* [Docker build with --squash argument](../docs/reference/commandline/build.md#squash-an-images-layers---squash-experimental) * [Docker build with --squash argument](../docs/reference/commandline/build.md#squash-an-images-layers---squash-experimental)