1、查看Docker默认存放数据目录
[root@k8s-node1 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服务
3、移动Docker数据目录到指定的分区
[root@k8s-node1 app]# mv /var/lib/docker /app/data/docker #这里/app为挂载的网络存储NAS
[root@k8s-node1 app]# ln -s /app/data/docker /var/lib/docke #软链接到原来的目录
4、启动Docker服务查看存储目录
[root@k8s-node1 ~]# 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