Oracle 系统管理 - Linux 系统 - Backtrack 5 - 安全 - Juniper 技术 - Cisco 技术 - 思科模拟器 - Cisco 认证 - Cisco ios 下载

您现在的位置是:Docker > Docker > Docker 解决镜像无法删除的问题

Docker 解决镜像无法删除的问题

时间:2018-08-10 09:18  来源:未知  阅读次数: 复制分享 我要评论

1. 首先查看镜像


  1. [root@docker-vp1 nexus-3.1.0-04]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
  4. jenkins/jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
  5. 192.168.1.110/centos/centos 7.2 38ea04e19303 12 months ago 194.6 MB
  6. 192.168.1.111/centos/centos 7.2 38ea04e19303 12 months ago 194.6 MB
2. 删除其中一个镜像,这里的镜像有两个repo引用,并且没有容器使用

  1. [root@docker-vp1 nexus-3.1.0-04]# docker rmi 38ea04e19303
  2. Error response from daemon: conflict: unable to delete 38ea04e19303 (must be forced) - image is referenced in one or more repositories
出现上面问题的原因: 对于被删除的ImageID,这里存在多个REPOSITORY名字引用,解决方法如下:

  1. [root@docker-vp1 nexus-3.1.0-04]# docker rmi 192.168.1.111/centos/centos:7.2
  2. Untagged: 192.168.1.111/centos/centos:7.2
  3. Untagged: 192.168.1.111/centos/centos@sha256:05c5e4ffbd3e4e54a685915394858e1dacc38873f02920b57b66551a1626dbd3

即删除时指定名称,而不是IMAGE ID。

然后再删除IMAGE ID就可以了:

  1. [root@docker-vp1 nexus-3.1.0-04]# docker rmi 38ea04e19303
  2. Untagged: 192.168.1.110/centos/centos:7.2
  3. Untagged: 192.168.1.110/centos/centos@sha256:05c5e4ffbd3e4e54a685915394858e1dacc38873f02920b57b66551a1626dbd3
  4. Deleted: sha256:38ea04e1930337de1455fed8651fcc9a029805f4559af44558ba9702340ce1e2
  5. Deleted: sha256:aa62a869f8107ec47faa7ad18eded96b051c249cd2f4a5d0d1bca8baf2757358
  6. Deleted: sha256:3c74eb540809de9dbddebd4681781bb1b6145c981756472cd67c6e3eb7704801
  7. Deleted: sha256:feba031447e29ed7d0f316065820e466ba91a258f3b2e68f8e21e940bc45b5cd
  8. Deleted: sha256:3d3648a4ed44853a2231971a1bccf855b83809767558e164bfebbea079d40c34
  9. Deleted: sha256:322e89546b1db8134d2a5b057779843aa80877705ce70e1182f20f94bf31a43d
  10. Deleted: sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
3. 继续查看剩余的镜像

  1. [root@docker-vp1 nexus-3.1.0-04]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. jenkins/jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
  4. jenkins 2.19.4 ff6f0851ef57 2 weeks ago 714.1 MB
相关资讯