Docker 填满 macOS 上的存储空间 [英] Docker filling up storage on macOS
问题描述
(帖子创建于 2016 年 10 月 5 日)
我注意到每次运行图像并删除它时,我的系统都不会恢复到原来的可用空间量.
I noticed that every time I run an image and delete it, my system doesn't return to the original amount of available space.
我应用于容器的生命周期是:
The lifecycle I'm applying to my containers is:
> docker build ...
> docker run CONTAINER_TAG
> docker stop CONTAINER_TAG
> rm docker CONTAINER_ID
> rmi docker image_id
[在默认的 mac 终端上运行]
容器实际上是从自定义图像创建的,从节点和标准 redis 运行.我的操作系统是 OSX 10.11.6.
The containers in fact were created from custom images, running from node and a standard redis. My OS is OSX 10.11.6.
在一天结束时,我发现我一直在失去 Mbs.我该如何面对这个问题?
At the end of the day I see I keep losing Mbs. How can I face this problem?
编辑后的帖子
2020 年,问题仍然存在,将此更新留给社区:
2020 and the problem persists, leaving this update for the community:
今天跑步:
- macOS 10.13.6
- Docker 引擎 18.9.2
- Docker 桌面 Cli 2.0.0.3
解决此问题的最简单方法是使用 Docker 实用程序修剪系统.
The easiest way to workaround the problem is to prune the system with the Docker utilties.
docker system prune -a --volumes
推荐答案
警告:
默认情况下,如果当前没有容器使用该卷,则不会删除卷以防止删除重要数据.在运行命令修剪卷时使用 --volumes
标志:
By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the
--volumes
flag when running the command to prune volumes as well:
Docker 现在有一个命令可以做到这一点:
Docker now has a single command to do that:
docker system prune -a --volumes
See the Docker system prune
docs
这篇关于Docker 填满 macOS 上的存储空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!