The method of modifying the storage location of Docker local image and container
Soft link
The default location for Docker is / var/lib/docker.
Command to view the specific location
Docker info | grep "Docker Root Dir"
The easiest way is to mount the partition to this directory. Because there is data in the data disk, modify the storage path of the image and container to achieve the goal. It is realized through soft connection.
Stop the Docker service:
Systemctl stop docker
Move the entire / var/lib/docker directory to the destination path:
Mv / var/lib/docker / root/data/docker / root/data/docke is the mounted disk ln-s / root/data/docker / var/lib/docker / / soft connection pointing to
When you start Docker, you find that the storage directory is still / var/lib/docker, but it is actually stored on the data disk, and you can see the capacity change on the data disk.
Systemctl start dockerdf-hT / / Mount docker info | grep "Docker Root Dir" / / you can see the path