1

With Help from Saied Kazemi I was able to checkpoint and migrate a container using criu on ubuntu 14 by this docker suspend and resume using criu

Now I am trying to migrate this container from one location to another.

I am using these steps:

export cid=$(docker run -d ubuntu tail -f /dev/null)
docker exec $cid touch /test.walid
mkdir /tmp/docker-migration
mkdir /tmp/docker-migration/$cid
docker checkpoint --image-dir=/tmp/docker-migration/$cid $cid
ssh walid@192.168.1.10 mkdir /tmp/docker-migration
ssh walid@192.168.1.10 mkdir /tmp/docker-migration/$cid
scp -r /tmp/docker-migration/$cid walid@192.168.1.10:/tmp/docker-migration
ssh walid@192.168.1.10 mkdir /tmp/$cid 
scp -r /var/lib/docker/0.0/containers/$cid walid@192.168.1.13:/tmp
ssh -t walid@192.168.1.10 sudo mv /tmp/$cid /var/lib/docker/0.0/containers/
ssh -t walid@192.168.1.10  sudo docker restore --force=true --image-dir=/tmp/docker-migration/$cid $cid

and Got this response

Error response from daemon: No such container: fea338e81750b2377c2a845e30c49b7055519e39448091715c2c6a7896da3562 Error: failed to restore one or more containers

Both Machines have docker and criu installed and checkpoint works alone.

Community
  • 1
  • 1
Walid Hanafy
  • 1,429
  • 2
  • 14
  • 26

3 Answers3

1

Docker container migration using CRIU is still under development. So far the focus of checkpoint and restore integration into Docker has been C/R'ing on the same machine.

That said, it is possible to manually migrate containers by not only copying the container image created by CRIU after checkpoint (as you have done) but also by copying the container directory created by Docker in /var/lib/docker/0.0/containers/$cid as well as the container's root filesystem in /var/lib/docker/0.0/image. Manually migrating container's filesystem is a bit tricky specially if you are using a union filesystem like AUFS or OverlayFS. Also, you need to restart the Docker daemon on the destination machine to see the container.

0

On the destination machine, you have to create or run a container. This container will be overwritten by the restored image.

So : ssh -t walid@192.168.1.10 export NewID=$(docker run -d ubuntu tail -f /dev/null) ssh -t walid@192.168.1.10 sudo docker restore --force=true --image-dir=/tmp/docker-migration/$cid $newID

In my case, that worked like a charm!

0

here is my test:

migration container across nodes.

restore: vagrant ssh vm2 -- 'docker run --name=foo -d ubuntu tail -f /dev/null && docker rm -f foo'

docker create --name=CONTAINNER_NAME base_image

docker restore --force=true --image-dir=/tmp/{dump files} 

github: https://github.com/hixichen/criu_test

xichen
  • 339
  • 2
  • 6
  • It's not clear whether you're posting a solution to the OP's problem or you're having a similar problem and posting your code that doesn't work. Can you clarify? – shoover May 20 '16 at 22:28
  • sorry,I should make it clear.I faced the same issue but when I run the 'docker run --name=foo -d ubuntu tail -f /dev/null && docker rm -f foo'. I got a correct restore. – xichen Jun 06 '16 at 18:41