Docker can take a toll on your disk space.
Fortunately you don’t have to keep the files in /var/lib/docker and on certain cloud providers like Digital Ocean it’s cheaper to attach a new block volume than to upgrade a droplet to get more disk space.
After you’ve decided on a location, simply do:
# systemctl stop docker # mkdir /new/path/docker # rsync -aqxP /var/lib/docker/ /new/path/docker
ChangeĀ /lib/systemd/system/docker.service:
ExecStart=/usr/bin/dockerd -g /new/path/docker -H fd://
Then:
# systemctl daemon-reload # systemctl start docker
When you’ve verified things are working, remove the old docker directory.
# rm -r /var/lib/docker