(2) Modify the default storage location of docker

After the default installation of docker is completed, the storage location of all docker images and related information is: /var/lib/docker

 

  Usually, our system disk mount disk is generally not very large, so we need to move it to other partitions. We can do it by soft connection. For example, let's move it to the /home/dockerfile directory. The specific method as follows:

 

1. First stop the docker service

[root@localhost docker]# service docker stop

 

2. Move the file to the specified directory:

[root@localhost docker]# cd /var/lib/

 

File copy:

[root@localhost lib]# mv docker/*/home/dockerfile


Delete the original docker folder under /var/lib/:

[root@localhost lib]# rm -rf docker

 

Enter /home/dockerfile to create a soft connection

[root@localhost dockerfile]# ln -s/home/dockerfile/ /var/lib/docker

 

3. Check, the current /var/lib/docker

[root@localhost lib]# ls -la docker

4. OK, start the service

[root@localhost lib]# service docker start

 

5. Enter the command to see if it is successful

[root@localhost lib]# docker info


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325516601&siteId=291194637