2015年9月4日 星期五

[ 常見問題 ] Why is docker image eating up my disk space that is not used by docker

Source From Here 
Question 
I have setup docker and I have used completely different block device to store docker's system data: 
# cat /etc/sysconfig/docker
  1. # /etc/sysconfig/docker  
  2. other_args="-H tcp://0.0.0.0:9367 -H unix:///var/run/docker.sock -g /disk1/docker"  

Note that /disk/1 is using a completely different hard drive /dev/xvdi. The problem is that when I continue download docker images and run docker containers, it seems that the other hard drive /dev/xvda1 is also used up

I can verify this problem by remove some docker images. After I removed some docker images, /dev/xvda1 has some more extra space now. 

How-To 
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 with option -g, --graph="/var/lib/docker" (Root of the Docker runtime) ("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 // Depending option -g.
# 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. 

Supplement 
When Docker.io eats up your disc space 
Docker document - daemon

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...