1、查看docker安装完成之后默认的路径
1 2 3 4
| [root@node3 docker] ..... Docker Root Dir: /var/lib/docker ......
|
2、修改docker.service配置文件,添加参数-graph /data/docker(/data/docker为指定的新的docker根目录)
vim /usr/lib/systemd/system/docker.service
1 2
| ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock - -graph /data/docker
|
3、修改完成之后,重新加载启动docker
1 2 3 4
| systemctl disable docker systemctl enable docker systemctl daemon-reload systemctl start docker
|
4、重新查看docker根目录
1 2 3 4
| [root@node3 docker] ..... Docker Root Dir: /data/docker .....
|