Modify the default storage path of Docker
When Docker is installed by default, the /var/lib/docker/ directory will be used as the storage directory to store the pulled images and created containers, etc.
Modification method
- Create a storage folder
mkdir -p /data/docker
- Edit the
/etc/docker/daemon.json
file
{
"data-root": "/data/docker"
}
- Restart Docker
systemctl daemon-reload
systemctl restart docker
- Check if the change is successful
docker info
Post comment 取消回复