I have setup docker and I have used completely different block device to store docker\'s system data:
[root@blink1 /]# cat /etc/sysconfig/docker
# /etc/sysc
Yes, Docker use /var/lib/docker folder to store the layers. There are ways to reclaim the space and move the storage to some other directory.
You can mount a bigger disk space and move the content of /var/lib/docker to the new mount location and make sym link.
There is detail explanation on how to do above task.
http://www.scmtechblog.net/2016/06/clean-up-docker-images-from-local-to.html
You can remove the intermediate layers too.
https://github.com/vishalvsh1/docker-image-cleanup
It's a kernel problem with devicemapper, which affects the RedHat family of OS (RedHat, Fedora, CentOS, and Amazon Linux). Deleted containers don't free up mapped disk space. This means that on the affected OSs you'll slowly run out of space as you start and restart containers.
The Docker project is aware of this, and the kernel is supposedly fixed in upstream (https://github.com/docker/docker/issues/3182).
A work-around of sorts is to give Docker its own volume to write to ("When Docker eats up you disk space"). This doesn't actually stop it from eating space, just from taking down other parts of your system after it does.
My solution was to uninstall docker, then delete all its files, then reinstall:
sudo yum remove docker
sudo rm -rf /var/lib/docker
sudo yum install docker
This got my space back, but it's not much different than just launching a replacement instance. I have not found a nicer solution.
As mentioned in issue #18867 - Delete data in a container devicemapper can not free used space from Github.com
Try running the below command:
# docker ps -qa | xargs docker inspect --format='{{ .State.Pid }}' | xargs -IZ fstrim /proc/Z/root/
It uses the fstrim tool to trim the devicemapper thinly-provisioned disk.