<div dir="ltr"><div><div>I just requested an account so that I'd have edit permission. As soon as it's set up, I'll add it to the Docker HOWTO page.</div></div><div><br></div><div>--Saied</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 12, 2014 at 12:59 AM, Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/11/2014 10:11 PM, Saied Kazemi wrote:<br>
> Great! Here is some additional text for the HOWTO page that introduces<br>
> docker_cr.sh and explains its usage.<br>
<br>
</span>It's very useful, thanks :) Can you integrate this text into<br>
the <a href="http://criu.org/Docker" target="_blank">http://criu.org/Docker</a> page?<br>
<div><div class="h5"><br>
> --Saied<br>
><br>
><br>
> Helper Script<br>
><br>
> As seen in the above examples, the CRIU command line for checkpointing and<br>
> restoring a Docker container is pretty long. For restore, there is also<br>
> an additional step to set up the root filesystem before invoking CRIU.<br>
><br>
> To automate the C/R process, there is a helper script in the contrib<br>
> subdirectory of CRIU sources, called docker_cr.sh. In addition to<br>
> invoking CRIU, this helper script sets up the root filesystem for AUFS,<br>
> UnionFS, and VFS for restore.<br>
><br>
> With docker_cr.sh, all you have to provide is the container ID.<br>
> If you don't specify a container ID, docker_cr.sh will list all running<br>
> containers and prompt you to choose one. Also, as shown in the help<br>
> output below, by setting the appropriate environment variable, it's<br>
> possible to tell docker_cr.sh which Docker and CRIU binaries to use,<br>
> where Docker's home directory is, and where CRIU should save and look<br>
> for its image files.<br>
><br>
> # docker_cr.sh --help<br>
> Usage:<br>
> docker_cr.sh -c|-r [-hv] [<container_id>]<br>
> -c, --checkpointcheckpoint container<br>
> -h, --helpprint help message<br>
> -r, --restorerestore container<br>
> -v, --verboseenable verbose mode<br>
><br>
> Environment:<br>
> DOCKER_HOME(default /var/lib/docker)<br>
> CRIU_IMG_DIR(default /var/lib/docker/criu_img)<br>
> DOCKER_BINARY(default docker)<br>
</div></div>> CRIU_BINARY(default criu)<br>
<div><div class="h5">><br>
> Below is an example to checkpoint and restore Docker container 4397:<br>
><br>
> # docker_cr.sh -c 4397<br>
> dump successful<br>
> # docker_cr.sh -r 4397<br>
> restore successful<br>
><br>
> Optionally, you can specify -v to see the commands that docker_cr.sh<br>
> executes. For example:<br>
><br>
> # docker_cr.sh -c -v 40d3<br>
> docker binary: docker<br>
> criu binary: criu<br>
> image directory: /var/lib/docker/criu_img/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
> container root directory: /var/lib/docker/aufs/mnt/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
><br>
> criu dump -v4 -D /var/lib/docker/criu_img/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf -o dump.log --manage-cgroups --evasive-devices --ext-mount-map /etc/resolv.conf:/etc/resolv.conf --ext-mount-map /etc/hosts:/etc/hosts --ext-mount-map /etc/hostname:/etc/hostname --ext-mount-map /.dockerinit:/.dockerinit -t 5991 --root /var/lib/docker/aufs/mnt/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
><br>
> dump successful<br>
> (00.020827) Dumping finished successfully<br>
><br>
> # docker_cr.sh -r -v 40d3<br>
> docker binary: docker<br>
> criu binary: criu<br>
> image directory: /var/lib/docker/criu_img/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
> container root directory: /var/lib/docker/aufs/mnt/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
><br>
> mount -t aufs -o<br>
> /var/lib/docker/aufs/diff/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
> /var/lib/docker/aufs/diff/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf-init<br>
> /var/lib/docker/aufs/diff/a9eb172552348a9a49180694790b33a1097f546456d041b6e82e4d7716ddb721<br>
> /var/lib/docker/aufs/diff/120e218dd395ec314e7b6249f39d2853911b3d6def6ea164ae05722649f34b16<br>
> /var/lib/docker/aufs/diff/42eed7f1bf2ac3f1610c5e616d2ab1ee9c7290234240388d6297bc0f32c34229<br>
> /var/lib/docker/aufs/diff/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158<br>
> none<br>
> /var/lib/docker/aufs/mnt/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf<br>
><br>
> criu restore -v4 -D /var/lib/docker/criu_img/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf -o restore.log --manage-cgroups --evasive-devices --ext-mount-map /etc/resolv.conf:/var/lib/docker/containers/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf/resolv.conf --ext-mount-map /etc/hosts:/var/lib/docker/containers/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf/hosts --ext-mount-map /etc/hostname:/var/lib/docker/containers/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf/hostname --ext-mount-map /.dockerinit:/var/lib/docker/init/dockerinit-1.0.0 -d --root /var/lib/docker/aufs/mnt/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf --pidfile /var/lib/docker/criu_img/40d363f564e00a2f893579fa012a200e475dcf8df47f2a22b7dd0860ffc3d7bf/restore.pid<br>
><br>
> restore successful<br>
> (00.408807) Restore finished successfully. Resuming tasks.<br>
><br>
> root 6206 1 1 10:49 ? 00:00:00 /bin/sh -c i=0; while true; do echo $i >> /foo; i=$(expr $i + 1); sleep 3; done<br>
><br>
><br>
><br>
</div></div><span class="">> On Tue, Sep 9, 2014 at 5:10 AM, Pavel Emelyanov <<a href="mailto:xemul@parallels.com">xemul@parallels.com</a> <mailto:<a href="mailto:xemul@parallels.com">xemul@parallels.com</a>>> wrote:<br>
><br>
> On 09/03/2014 11:28 PM, Filipe Brandenburger wrote:<br>
</span>> > Acked-by: Filipe Brandenburger <<a href="mailto:filbranden@google.com">filbranden@google.com</a> <mailto:<a href="mailto:filbranden@google.com">filbranden@google.com</a>>><br>
<span class="">> ><br>
> > On Wed, Sep 3, 2014 at 12:27 PM, Saied Kazemi <<a href="mailto:saied@google.com">saied@google.com</a> <mailto:<a href="mailto:saied@google.com">saied@google.com</a>>> wrote:<br>
> >> As promised, here is a shell script to simplify checkpointing and restoring<br>
> >> a Docker container. The usage is pretty simple and obvious. Try<br>
> >> docker_cr.sh --help to get started. I suggest adding this file to the<br>
> >> scripts subdirectory of CRIU and installing it where criu is installed, but<br>
> >> I have not modified the Makefile.<br>
> >><br>
> >> I'd like to acknowledge Filipe's time for his review and feedback.<br>
> >><br>
> >> Cheers!<br>
><br>
> Sorry for the delay. The patch is applied with the scripts/ -> contrib/<br>
> directory change. Huge thanks!<br>
><br>
><br>
><br>
><br>
</span>> _______________________________________________<br>
> CRIU mailing list<br>
> <a href="mailto:CRIU@openvz.org">CRIU@openvz.org</a><br>
> <a href="https://lists.openvz.org/mailman/listinfo/criu" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
><br>
<br>
</blockquote></div><br></div>