docker删除镜像image is referenced in one or more repositories
我们在删除镜像的时候,有时候会报:image is referenced in one or more repositories的错误,出现此错误的原因是:被删除的ImageID,这里存在多个REPOSITORY名字引用
我们在删除镜像的时候,有时候会报:image is referenced in one or more repositories的错误,出现此错误的原因是:被删除的ImageID,这里存在多个REPOSITORY名字引用
1. 首先查看镜像
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
jenkins/jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
192.168.1.110/centos/centos 7.2 38ea04e19303 12 months ago 194.6 MB
192.168.1.111/centos/centos 7.2 38ea04e19303 12 months ago 194.6 MB
2. 删除其中一个镜像,这里的镜像有两个repo引用,并且没有容器使用
docker rmi 38ea04e19303
# 错误提示:
Error response from daemon: conflict: unable to delete 38ea04e19303 (must be forced) - image is referenced in one or more repositories
出现上面问题的原因:
对于被删除的ImageID,这里存在多个REPOSITORY名字引用,解决方法如下:
docker rmi 192.168.1.111/centos/centos:7.2
Untagged: 192.168.1.111/centos/centos:7.2
Untagged: 192.168.1.111/centos/centos@sha256:05c5e4ffbd3e4e54a685915394858e1dacc38873f02920b57b66551a1626dbd3
即删除时指定名称,而不是IMAGE ID。
然后再删除IMAGE ID就可以了:
docker rmi 38ea04e19303
Untagged: 192.168.1.110/centos/centos:7.2
Untagged: 192.168.1.110/centos/centos@sha256:05c5e4ffbd3e4e54a685915394858e1dacc38873f02920b57b66551a1626dbd3
Deleted: sha256:38ea04e1930337de1455fed8651fcc9a029805f4559af44558ba9702340ce1e2
Deleted: sha256:aa62a869f8107ec47faa7ad18eded96b051c249cd2f4a5d0d1bca8baf2757358
3. 继续查看剩余的镜像
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkins/jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
版权声明
本站部分原创文章,部分文章整理自网络。如有转载的文章侵犯了您的版权,请联系站长删除处理。如果您有优质文章,欢迎发稿给我们!联系站长:
愿本站的内容能为您的学习、工作带来绵薄之力。
评论