Why is docker image eating up my disk space that is not used by docker

前端 未结 9 2038
长发绾君心
长发绾君心 2020-12-12 11:07

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         


        
9条回答
  •  一整个雨季
    2020-12-12 12:08

    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.

提交回复
热议问题