docker默認(rèn)數(shù)據(jù)都保存在/var/lib/docker目錄下笋婿,默認(rèn)情況下根分區(qū)空間都不大膨蛮,在網(wǎng)上找到個方案:
service docker stop
cp -prf /var/lib/docker /mnt/data/
umount /var/lib/docker/devicemapper
umount /var/lib/docker/plugins
rm -rf /var/lib/docker
ln -s /mnt/data/docker /var/lib
(或用fstab和mount)
vi /etc/fstab
追加以下內(nèi)容:/data/docker /var/lib/docker none bind 0 0
mount -a
thin_check /mnt/data/docker/devicemapper/devicemapper/metadata
thin_check --clear-needs-check-flag /mnt/data/docker/devicemapper/devicemapper/metadata
service docker start
后續(xù)步驟:
- 刪除沒啟動的images:
docker rmi $(docker images -q) - 刪除沒啟動的containers
docker rm $(docker ps -a -q)