本教程只适用 Docker 版本 >= v17.05.0
命令 df -Th
可以看到当前docker存储的路径
迁移docker文件
cp -a /var/lib/docker /sdb2/
修改 daemon.json 文件 "graph":"/sdb2/docker"
[root@devops ~]# vim/etc/docker/daemon.json
{
"graph":"/sdb2/docker",
"registry-mirrors": ["http://hub-mirror.c.163.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","https://01xxgaft.mirror.aliyuncs.com"],
"exec-opts":["native.cgroupdriver=systemd"],
"log-driver":"json-file",
"log-opts":{"max-size":"100m"},
"storage-driver":"overlay2",
"insecure-registries":["192.168.0.1:8082", "192.168.0.1:8084"]
}
重启 Docker & 清理原安装(存储)目录
重启
sudo systemctl restart docker
# or
sudo service docker restart
完成迁移之后,在确认 Docker 能正常工作之后,删除原目录数据
rm -rf /var/lib/docker
标签:存储,在线,sdb2,json,https,docker,com,Docker
From: https://www.cnblogs.com/beihangxuwei/p/17448067.html