Docker 容器迁移
1.把集群中docker node降级
(1)# docker node demote pro-star-kv224-85
2.在node上停止docker进程和修改配置
(1)停止docker服务
①#systemctl daemon-reload
②#service docker stop //如果停止不了就用pkill -9 docker
(2)#mkdir /data1/docker
(3)vim /etc/systemd/system/multi-user.target.wants/docker.service
//ExecStart=/usr/bin/dockerd改为ExecStart=/usr/bin/dockerd --graph=/data1/docker
(4)删除移动/var/lib/docker中的文件到新目录
#mv /var/lib/docker/ /data1/docker
#rm -rf /var/lib/docker/
(5)卸载overlay挂载
如果出现如上提示则:
#umount overlay
#umount shm
3.在集群中删除该node
(1) 查看node状态
(2)#docker node rm pro-star-kv224-85
4.重启docker服务
①#systemctl daemon-reload
②#service docker start
(2)查看结果
#docker info
5.把node重新加入到集群
(1)获取token值:
①#docker swarm join-token manager
6.在node端运行添加
(1)#docker swarm join --token SWMTKN-1-20fd8y0rs2hu5bjcee808bm9oocyoqae1gybsjnwd8skvdd4aa-04rarseip7h9ke6609d6fdrqe 192.168.224.81:2377
(2)#docker node ls
转载于:https://blog.51cto.com/niming2008/2313446