1, 查看 Docker 默认存放数据目录
- [[email protected] tools]# docker info | grep "Docker Root Dir"
- WARNING: API is accessible on http://127.0.0.1:4243 without encryption.
- Access to the remote API is equivalent to root access on the host. Refer
- to the 'Docker daemon attack surface' section in the documentation for
- more information: https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
- Docker Root Dir: /var/lib/docker
2, 停止 Docker 服务
systemctl stop docker
3, 移动 Docker 数据目录到指定的分区
- [[email protected] App]# mv /var/lib/docker /App/data/docker #这里 / App 为挂载的网络存储 NAS
- [[email protected]-node1 App]# ln -s /App/data/docker /var/lib/docke #软链接到原来的目录
4, 启动 Docker 服务查看存储目录
- systemctl start docker
- [[email protected] ~]# docker info|grep "Docker Root Dir"
- WARNING: API is accessible on http://127.0.0.1:4243 without encryption.
- Access to the remote API is equivalent to root access on the host. Refer
- to the 'Docker daemon attack surface' section in the documentation for
- more information: https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
- Docker Root Dir: /App/data/docker
来源: http://www.bubuko.com/infodetail-3367807.html