Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 528
Anik Barua Avatar asked Feb 07 '18 22:02

Anik Barua


People also ask

What is checkpoint in Docker?

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 on disk. Later, the container can be restored from the point it was frozen.

How do I make my Docker experimental true?

Docker experimental features can be enabled by adding an /etc/docker/daemon. json with {"experimental": true} on the Remote Docker instance and restarting the daemon. Be sure to set a Docker version that supports the functionality you are looking to make use of. If enabled, the command will print a value of true .

Is Podman free?

Podman is a project from Red Hat that is open source and free to download. It is a relative newcomer to the containerization scene, with version 1.0 being released in 2019.


1 Answers

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
like image 141
tgogos Avatar answered Oct 08 '22 05:10

tgogos