清理 Docker 镜像占用的磁盘空间 [英] Cleanup disk space occupied by Docker images

查看:62
本文介绍了清理 Docker 镜像占用的磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 上运行 docker.

I am running docker on windows 10.

我的机器中存储了几张图像.这些图像的总大小累积到大约 10GB.我已经通过 'docker rmi -f' 命令删除了这些图像.

I had a couple of images stored in my machine. The total size of these images accumulated to around ~10GB. I have deleted these images via 'docker rmi -f' command.

但是这些图片占用的空间还没有被释放.如果我运行docker images"命令,删除的图像不会在docker images"命令的输出中列出(但磁盘空间没有清理).

But the space occupied by these images has not been released. If I run 'docker images' command, the deleted images are not listed in the output of 'docker images' command(but the disk space is not cleaned up).

如何改善(即减少)docker 使用的磁盘空间?

How can I improve (ie. reduce) the disk space used by docker?

推荐答案

先试运行:

docker 系统修剪

它将删除:

  • 所有停止的容器
  • 至少一个容器未使用所有卷
  • 至少一个容器未使用的所有网络
  • 所有悬空图像

如果这还不够,请执行以下操作:

docker system prune -a

它将删除:

  • 所有停止的容器
  • 至少一个容器未使用所有卷
  • 至少一个容器未使用的所有网络
  • 至少没有一个关联容器的所有图片

如果没有达到预期效果,请尝试以下操作

docker 卷修剪

它将删除至少一个容器未使用的所有本地卷.

It will remove all local volumes not used by at least one container.

这篇关于清理 Docker 镜像占用的磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆