/ Var / lib / docker take up too much space migration

http://www.mamicode.com/info-detail-1917569.html

https://yq.aliyun.com/articles/272173

https://blog.csdn.net/weixin_32820767/article/details/81196250

 

method one

Stop docker service, systemctl STOP docker
vi /etc/docker/daemon.json
increase options "graph": "/ home / docker",
start docker service, systemctl start docker

 

Method Two

cd /var/lib/
mv docker/* /home/docker
rm -rf docker
ln -s /home/docker/ /var/lib/docker

Method Three

Docker configuration file can be set most parameters of the background process, inconsistencies in the storage position of each operating system, location in Ubuntu is: / etc / default / docker, CentOS position is: / etc / sysconfig / docker .

If you add the following line Ubuntu (Ubuntu by default because not open selinux):

OPTIONS=--graph="/root/data/docker" -H fd://# 或者DOCKER_OPTS="-g /root/data/docker"

Finally restart, Docker on the path into / root / data / docker up.

If centos7:

Modify docker.service file, use the -g parameter to specify the storage location

we /usr/lib/systemd/system/docker.service  

ExecStart=/usr/bin/dockerd --graph /new-path/docker 

 // reload the configuration file 

systemctl daemon-reload 

 // restart docker 

systemctl restart docker.service

// Check Docker Root Dir: / var / lib / directory is set to change whether docker / new-path / docker 

docker info

Guess you like

Origin www.cnblogs.com/i-shu/p/11403039.html