问题描述
我创建了一个 本地 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
是您的图像 ID.
这篇关于如何删除具有相同 imageID 的多个 docker 图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!