CRIU in Docker
在Docker中可以使用CRIU。必须启用Experimental。可以在启动的时候加入--experimental
选项,或者修改Docker的配置文件。在/etc/docker/daemon.json
中加入:
{
"experimental": true
}
检查是否正确启用
docker version -f '{{.Server.Experimental}}'
参考Docker Experimental Features。
测试
Checkpoint
First, we create container:
$ docker run -d --name looper --security-opt seccomp:unconfined busybox \
/bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
You can verify the container is running by printings its logs:
$ docker logs looper
If you do this a few times you'll notice the integer increasing. Now, we checkpoint the container:
$ docker checkpoint create looper checkpoint1
Restore
$ docker start --checkpoint checkpoint1 looper
Restoring into a new container
$ docker run -d --name looper2 --security-opt seccomp:unconfined busybox \
/bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
# wait a few seconds to give the container an opportunity to print a few lines, then
$ docker checkpoint create --checkpoint-dir=/tmp looper2 checkpoint2
$ docker create --name looper-clone --security-opt seccomp:unconfined busybox \
/bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
$ docker start --checkpoint-dir=/tmp --checkpoint=checkpoint2 looper-clone
More please visit CRIU with Docker
Also Docker Checkpoint & Restore
SCP
拷贝完成后就该SCP传输文件了。
但是尝试了几次发现22端口总是被拒绝。一开始还以为是VMWare的原因,一直报错:
ssh: connect to host 192.168.47.128 port 22: Connection refused
lost connection
搜索了一下VMWare的NAT模式并没有任何问题,有些文章针对NAT的端口转发也只是针对物理机->虚拟机的,而不是虚拟机->虚拟机。
再查了一下发现这么一篇文章。vmware中的Ubuntu安装ssh全家桶(解决connect to host localhost port 22: Connection refused)
于是终于知道原来是Ubuntu自己的问题。居然不自带SSH Server?
解决起来就简单了。
apt-get install openssh-server
然后就可以愉快的用scp了。