Merge pull request #600 from boucher/criu-readme
README example for using checkpoint/restore.
This commit is contained in:
commit
703d9a1554
32
README.md
32
README.md
|
@ -168,6 +168,38 @@ looking to see if `state.json` is in the root of the directory.
|
|||
You may also specify an alternate root place where
|
||||
the `container.json` file is read and where the `state.json` file will be saved.
|
||||
|
||||
|
||||
#### Checkpoint & Restore
|
||||
|
||||
libcontainer now integrates [CRIU](http://criu.org/) for checkpointing and restoring containers.
|
||||
This let's you save the state of a process running inside a container to disk, and then restore
|
||||
that state into a new process, on the same machine or on another machine.
|
||||
|
||||
`criu` version 1.5.2 or higher is required to use checkpoint and restore.
|
||||
If you don't already have `criu` installed, you can build it from source, following the
|
||||
[online instructions](http://criu.org/Installation). `criu` is also installed in the docker image
|
||||
generated when building libcontainer with docker.
|
||||
|
||||
To try an example with `nsinit`, open two terminals to the same busybox directory.
|
||||
In the first terminal, run a command like this one:
|
||||
```bash
|
||||
nsinit exec -- sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
|
||||
```
|
||||
|
||||
You should see logs printing to the terminal every second. Now, in the second terminal, run:
|
||||
```bash
|
||||
nsinit checkpoint --image-path=/tmp/criu
|
||||
```
|
||||
|
||||
The logs in your first terminal will stop and the process will exit. Finally, in the second
|
||||
terminal, run the restore command:
|
||||
```bash
|
||||
nsinit restore --image-path=/tmp/criu
|
||||
```
|
||||
|
||||
The process will resume counting where it left off and printing to the new terminal window.
|
||||
|
||||
|
||||
#### Future
|
||||
See the [roadmap](ROADMAP.md).
|
||||
|
||||
|
|
Loading…
Reference in New Issue