当前位置:   article > 正文

Docker 热迁移探索,基于CRIU实现状态迁移_dockrr criu

dockrr criu

版本限制

  • Docker: 17.06.0-ce
  • criu: 3.12
  • kernal: 3.10.0-957.el7.x86_64 || 5.10.2-1.el7.elrepo.x86_64 (Optional)
  • os: CentOS Linux release 7.9.2009 (Core) (Optional)

实测在该环境下,容器热迁移可用,热迁移成功与否与 dockercriu 版本强相关。

环境部署


# Docker 安装
$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum list docker-ce --showduplicates | sort -r
$ sudo yum install docker-ce-17.06.0.ce

# 启动Docker实验特征
vim **/etc/docker/daemon.json
+ {
    "experimental": true }

#** 启动docker并设置开机自启
****$ sudo systemctl enable docker
$ sudo systemctl start docker

# criu 安装
$ sudo yum install criu -y

# Go安装(可选)
wget https://golang.org/dl/go1.15.6.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz
vim /etc/profile
+ export PATH=$PATH:/usr/local/go/bin
source /etc/profile
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

热迁移示例

# On the host
$ 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 looper2 checkpoint2

# check your container & print log file
$ docker logs looper2

# On the client
$ docker create --name looper-clone --security-opt seccomp:unconfined busybox \
        
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/461396
推荐阅读
相关标签
  

闽ICP备14008679号