Another solution on OS level can be to mount /var/lib/docker on a dedicated partition.
To do this, please, stop Docker, make sure that no process accesses /var/lib/docker and do the following:
Provide an additional volume. In this example it is /dev/sdx8.
Format it accordingly, i.e.
mkfs.xfs -n ftype=1 /dev/sdx8
or
mkfs.ext4 /dev/sdx8
etc.
If it fails in mkfs.xfs you might run a newer version of mkfs.xfs which has ftype=1 already as default. Just issue
mkfs.xfs /dev/sdx8
Stop Docker.
service docker stop
Make sure the directory is not used anymore:
lsof | grep /var/lib/docker
Prepare directories and mount the new volume:
mv /var/lib/docker /var/lib/__docker
mkdir /var/lib/docker
mount /dev/sdx8 /var/lib/docker
Move all contents there to:
rsync -aH /var/lib/__docker/ /var/lib/docker
# mind the trailing slash. It takes care to copy the whole tree to the right position.
Don’t forget to add /dev/sdx8 to /etc/fstab.
Remove the old directory if everything is fine.
rm -rf /var/lib/__docker