The default data directory for docker is /var/lib/docker
View command:
[root@node1 ~]# docker info
How to modify?
Modify the default value by modifying the docker.service file and specifying a directory. If you don’t know where the docker.service file is, you can get the file path through the following command:
[root@node1 ~]# systemctl disable docker
Removed symlink /etc/systemd/system/multi-user.target.wants/docker.service.
[root@node1 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@node1 ~]#
Edit the file and add the graph attribute. The value corresponding to the graph is the docker data directory:
(Note: there is no space between – and graph)
vi /usr/lib/systemd/system/docker.service
Then enable the docker service to re-execute the soft link and perform a daemon-reload
[root@node1 ~]# systemctl enable docker
[root@node1 ~]# systemctl daemon-reload
[root@node1 ~]# systemctl restart docker
[root@node1 ~]#
Docker info again, found that the directory has been updated: