Docker: I would like to save images to /srv/docker and not /var/lib/docker, because my /var/ partition is only 7 GB
To change the Docker data directory to /srv/docker and save your images there, follow these steps:
Stop Docker service:
bash sudo systemctl stop dockerCopy existing Docker data to the new location:
bash sudo rsync -aP /var/lib/docker/ /srv/docker/Set the new data directory by editing the Docker daemon configuration file (
/etc/docker/daemon.json):json { "data-root": "/srv/docker" }Restart Docker service to apply changes:
bash sudo systemctl start docker
Ensure that /srv/docker has sufficient space and appropriate permissions.