docker删除映像_从命令行使用Docker映像

docker删除映像

You can list all the images you have downloaded or installed using the

您可以使用列出所有已下载或安装的映像

docker images -a

command:

命令:

You can remove an image with docker rmi command, passing the name of the image you want to remove. This will remove the image.

您可以使用docker rmi命令删除图像,并传递要删除的图像的名称。 这将删除图像。

Sometimes when testing and developing, some images become dangling, which means untagged images. They can always be safely removed to free disk space.

有时在测试和开发时,有些图像会悬空,这意味着未标记的图像。 始终可以安全地删除它们以释放磁盘空间。

Running docker images -f dangling=true will list them:

运行docker images -f dangling=true将列出它们:

And you can clear them with docker rmi $(docker images -f dangling=true -q). This command will only eliminate dangling images used in containers, even if not currently running.

您可以使用docker rmi $(docker images -f dangling=true -q)清除它们。 即使当前未运行,此命令也将仅消除容器中使用的悬挂图像。

docker system prune -a, which is also a commonly used way to remove images, will also remove images not referenced by any container, which might remove images you might want to keep, even just to rollback to previous versions of an image.

docker system prune -a也是一种删除映像的常用方法,它还会删除任何容器未引用的映像,这可能会删除您可能想要保留的映像,甚至只是回滚到映像的先前版本。

You can also remove all images using docker rmi $(docker images -a -q) if you want to clean everything, which might be nice during your first tests and experiments with Docker.

如果您想清理所有内容,也可以使用docker rmi $(docker images -a -q)删除所有图像,这在您进行Docker的第一次测试和实验时可能会很好。

翻译自: https://flaviocopes.com/docker-images-command-line/

docker删除映像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值