docker把系统盘占满后的恢复

2016-02-04  本文已影响1412人  ff7e4f9cb3e3

docker默认数据都保存在/var/lib/docker目录下,默认情况下根分区空间都不大,在网上找到个方案:
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
追加以下内容:/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

后续步骤:

  1. 删除没启动的images:
    docker rmi $(docker images -q)
  2. 删除没启动的containers
    docker rm $(docker ps -a -q)
上一篇下一篇

猜你喜欢

热点阅读