docker删除镜像时报错:image is referenced in multiple repositories
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 7 8652b9f0cb4c 4 weeks ago 204MB
centos 7.9.2009 8652b9f0cb4c 4 weeks ago 204MB
想删除这个centos镜像
不过在删除时失败
报错:同一个镜像在多个存储库中被引用
[root@localhost ~]# docker rmi 8652b9f0cb4c
Error response from daemon: conflict: unable to delete 8652b9f0cb4c (must be forced) -
image is referenced in multiple repositories
解决办法
1.使用repository和tag的方法删除
[root@localhost ~]# docker rmi centos:7.9.2009
Untagged: centos:7.9.2009
Untagged: centos@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
Deleted: sha256:8652b9f0cb4c0599575e5a003f5906876e10c1ceb2ab9fe1786712dac14a50cf
Deleted: sha256:174f5685490326fc0a1c0f5570b8663732189b327007e47ff13d2ca59673db02
[root@localhost ~]# docker images centos
REPOSITORY TAG IMAGE ID CREATED SIZE
再次查看,两个镜像都被删除了
2.使用-f选项进行删除
在docker rmi参数中,有-f选项,强制删除镜像
[root@localhost ~]# docker rmi -f 8652b9f0cb4c
Untagged: centos:7
Untagged: centos:7.9.2009
Untagged: centos@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
Deleted: sha256:8652b9f0cb4c0599575e5a003f5906876e10c1ceb2ab9fe1786712dac14a50cf
再次查看,镜像没有了,删除成功
还没有评论,来说两句吧...