Merge pull request #3333 from thaJeztah/docs_checkpoint_fixups

docs: some minor touch-ups in checkpoint reference
This commit is contained in:
Sebastiaan van Stijn 2021-10-11 18:53:57 +02:00 committed by GitHub
commit 6d2820b530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 12 deletions

View File

@ -18,14 +18,14 @@ checkpoint and restore in Docker is available in this
### 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](https://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 and restore in Docker.
### Use cases for checkpoint & restore ### Use cases for checkpoint and 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:
@ -35,21 +35,22 @@ restore. Here are a few:
- "Rewinding" processes to an earlier point in time - "Rewinding" processes to an earlier point in time
- "Forensic debugging" of running processes - "Forensic debugging" of running processes
Another primary use case of checkpoint & restore outside of Docker is the live 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 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 and 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)
- `ls` (lists existing checkpoints)
- `rm` (deletes an existing checkpoint)
Additionally, a `--checkpoint` flag is added to the container start command. - `docker checkpoint create` (creates a new checkpoint)
- `docker checkpoint ls` (lists existing checkpoints)
- `docker checkpoint rm` (deletes an existing checkpoint)
The options for checkpoint create: Additionally, a `--checkpoint` flag is added to the `docker container start` command.
The options for `docker checkpoint create`:
```console ```console
Usage: docker checkpoint create [OPTIONS] CONTAINER CHECKPOINT Usage: docker checkpoint create [OPTIONS] CONTAINER CHECKPOINT
@ -66,7 +67,7 @@ And to restore a container:
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: Example of using checkpoint and restore on a container:
```console ```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'
@ -79,7 +80,7 @@ $ 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 run `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.