search

Home  >  Q&A  >  body text

docker下载的镜像加起来不到3G,可是存储文件用掉了10多G是咋回事啊?

我下载的镜像很多都是id相同的,我试着加了一下,不同id的相加大概3G多,可是/var/lib/docker目录大小是13G,也就启动了两个容器而已,这里面有一些垃圾文件吧,是不是我制作镜像的时候的一些缓存,怎么把这些删掉呢?

某草草某草草2770 days ago747

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-04-25 09:03:30

    If your host is CentOS and you are using the default loop file, there is no way. CentOS does not have Union FS implementation, and this sparse file will continue to grow if simulated. Ubuntu/Debian does not have this problem.

    As for the issue of clearing unused images and building intermediate images. You can docker images -a 看一下是不是有过多的 <none> 的镜像了,其中有一部分是这类镜像。删除他们直接 docker rmi $(docker images -aq -f "dangling=true") first. Then it should be much less if you look at it again.

    In addition, the contents of your container are also in the storage layer. Can be deleted with docker ps -a 看一下是不是有很多之前的容器没有删掉的,同样,也可以 docker rm $(docker ps -aq -f "dangling=true").

    reply
    0
  • Cancelreply