如何删除具有相同imageID的多个docker映像? [英] How to remove multiple docker images with the same imageID?

查看:466
本文介绍了如何删除具有相同imageID的多个docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个本地Docker注册表,然后从Docker Hub中提取了一些Docker映像然后将它们推送到本地注册表。现在,我要删除本地图像。但是这里的问题是图像的 imageID 相同,我无法删除它们。我搜索了解决方案,但找不到解决方案。

I created a local docker registry and then pull some of my docker images from docker hub and then push them to the local registry. Now I want to remove my local images. But the problem here is that imageID of the images are the same and I cannot remove them. I searched for the solution but I couldn't find the solution.

>> docker images

REPOSITORY                     TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
localhost:5000/[repo1]        v-0.9.1              810001cb03af        4 weeks ago         594.6 MB
[myaccount]/[repo1]           v-0.9.1              810001cb03af        4 weeks ago         594.6 MB

您看到图片ID 对于两个图像都是相同的。我如何删除它们?

as you see the image ID are the same for both images. How can I remove them?

编辑


  • 我的docker版本:

  • my docker version:

Docker版本1.8.2,内部版本0a8c2e3

docker rmi 810001cb03af 的输出:

守护程序的错误响应:冲突,无法删除图像810001cb03af,因为它被标记了多个存储库,请使用-f强制错误:无法删除图像:[810001cb03af]

Error response from daemon: Conflict, cannot delete image 810001cb03af because it is tagged in multiple repositories, use -f to force Error: failed to remove images: [810001cb03af]

如果我执行 docker rmi -f 81000 将会删除它们,我需要再次拉。

If I do docker rmi -f 81000 it will remove both of them and I need to pull again.

推荐答案

这里是您可以执行此操作的一种方法。运行命令:

Here is a way you could do this. Run the command:

docker images | grep 810001cb03af | awk '{print $1 ":" $2}' | xargs docker rmi

其中 810001cb03af 是您的图像

这篇关于如何删除具有相同imageID的多个docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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