background

The docker image container directory is stored on the Linux system disk by default. As a result, the space on the system disk is insufficient, you need to migrate the docker image container directory to another disk

Stop the service

systemctl stop docker
# or
/etc/init.d/docker stop
Copy the code

Migration directory

Create a directory
mkdir -p /home/docker
mv /var/lib/docker/* /home/docker/
Copy the code

Modifying a Configuration File

vim /etc/sysconfig/docker
# increase -- graph = / home/docker
other_args="--graph=/home/docker"
Copy the code

Establishing a soft connection

rm -rf /var/lib/docker
ln -s /home/docker /var/lib/docker
Copy the code

Restart the service

systemctl restart docker
# or
/etc/init.d/docker restart
Copy the code

Docker image container directory migration