Anik Barua
Anik Barua

Reputation: 3461

Docker - Cannot checkpoint container

I am trying to use checkpoint in a busybox image. At first I created a regular loop and then printing the numbers.

docker run -d --name simple13 busybox /bin/sh -c "i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done"

docker logs -f simple13

Then I tried to use checkpoint by following command -

docker checkpoint create simple13 checkpoint1

But, it shows some error like this -

    Error response from daemon: Cannot checkpoint container simple13: 
docker-runc did not terminate sucessfully: CRIU version check failed: exec: 
"criu": executable file not found in $PATH path= 
/var/run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/2fd6f5b517
3fb75ee2793d50602506ee6bc97fcd49df93141846fec21f003be4/criu-dump.log: unknown

The experimental is turned on here already. So, can you please inform me what I need to do here to use checkpoint correctly ? Thanks.

λ docker version
Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:05:22 2017
 OS/Arch:       windows/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:12:29 2017
  OS/Arch:      linux/amd64
  Experimental: true

Upvotes: 6

Views: 2141

Answers (1)

tgogos
tgogos

Reputation: 25250

You have some problem with the bash variable expansion. The way you pass the CMD will keep printing empty lines, not numbers. See how the command is finally set to the container (the result is part from docker container inspect ... output:

"Cmd": [
    "/bin/sh",
    "-c",
    "i=0; while true; do echo ; i=1; sleep 1; done"
], 

I've changed a little bit the use of quotes and the following prints numbers:

docker run -d --name simple13 busybox /bin/sh -c 'i=0; while true; do echo "$i"; i=$(expr "$i" + 1); sleep 1; done'

Notice the difference now in the Cmd result from docker container inspect simple13:

"Cmd": [
    "/bin/sh",
    "-c",
    "i=0; while true; do echo \"$i\"; i=$(expr \"$i\" + 1); sleep 1; done"
],

About the docker checkpoint create simple13 checkpoint1 error:

For me, it was solved after I used:

sudo apt-get install criu

But I think, it still doesn't work as it should. Example:

ubuntu@ubuntu:~$ docker run -d --name simple13 busybox /bin/sh -c 'i=0; while true; do echo "$i"; i=$(expr "$i" + 1); sleep 1; done'
1ffd1f30aec96e07ac7c229c581b7ccd5feb9d180602eeb663211189abc652e4
ubuntu@ubuntu:~$ docker logs simple13 
0
1
2
3
ubuntu@ubuntu:~$ docker checkpoint create simple13 checkpoint1
checkpoint1
ubuntu@ubuntu:~$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
1ffd1f30aec9        busybox             "/bin/sh -c 'i=0; wh…"   19 seconds ago      Up 18 seconds                           simple13
ubuntu@ubuntu:~$ docker logs simple13 
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ubuntu@ubuntu:~$ docker checkpoint ls simple13
Error response from daemon: open /var/lib/docker/containers/1ffd1f30aec96e07ac7c229c581b7ccd5feb9d180602eeb663211189abc652e4/checkpoints/checkpoint1/config.json: no such file or directory

Upvotes: 2

Related Questions