[CRIU] Do anyone knows how to migrate a container with web app

Pavel Emelyanov xemul at virtuozzo.com
Thu Apr 28 03:33:16 PDT 2016


On 04/28/2016 08:01 AM, Weicheng SUN wrote:
> Hi Everyone,
> 
> The latest release of cr-combined said that it supports network. Then I do some experiments. I use
> 1. docker run -d -v demo:/data --name=redis redis:latest
> 2. docker run -d -e USE_REDIS_HOST=redis --link redis:redis -p 80:80 --name=app binocarlos/moby-counter:latest
> which is a demo of simple website and redis is its storage. I first run them on host A
> 
> I try to checkpoint them and copy to another host(host B). I create two containers with same configuration
> of them and applied the change of file system to the new created container. Then I tried to restore them,
> which sometimes came out a wrong result.
> I notice that when redis and app have same ip address on host A and B, then the restore will success. But,
> when they have different IP on two hosts, the restore progress will certainly broken.
> 
> The reason I guess is that the state of tcp connection in checkpoint image didn't match the new environment
> in host B. For example, redis in host A is 17.172.20.1 and app in host A is 17.172.20.2, then for app there
> is a connection whose remote host is 17.172.20.1. Then come to host B, if redis in host B is 17.172.20.3 and
> when I try to restore app, criu will confuse where is 17.172.20.1(redis)?

After migration all the sockets get restored with the IP addresses they had on source node,
so if for some reason packets to former container IP cannot be delivered into container's
new location, the container would get broken. This is unavoidable limitation of TCP protocol
itself. There can be workarounds to this (DNAT-like for example), but this is out of CRIU's
scope and should be done on Docker level.

> Generally, is there always a problem to checkpoint and restore a container, who has a link with other 
> containers, on the another host?
> 
> And who knows that how to use a specific IP address while start a new container? For the latest release of 
> cr-combined doesn't support docker run --ip. Even --ip is supported, it requires a user defined network,
> default network is not supported. 
> 
> Hopes for your kindly response & wish all of you a great day!
> 
> Regards,
> 
> David Sun
> 
> 
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 



More information about the CRIU mailing list