解決刪除映象時 image is referenced in multiple repositories
阿新 • • 發佈:2018-12-20
1、檢視映象 docker images
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.0.1/jii/jenkins 1.0.1 3391ef1391f6 18 hours ago 206 MB 192.168.0.1/you/tom 1.0.8 f8ab12e03d53 22 hours ago 276 MB 192.168.0.1/you/tom 1.0.9 f8ab12e03d53 22 hours ago 276 MB
2、刪除映象,會報錯
$ docker rmi f8ab12e03d53
Error response from daemon: conflict: unable to delete f8ab12e03d53 (must be forced) - image is referenced in multiple repositories
仔細觀察,發現f8ab12e03d53這個映象id指向了兩個repository,因此無法刪除
3、刪除時可以用repository和tag的方式來刪除
$ docker rmi 192.168.0.1/you/tom:1.0.8 Untagged:192.168.0.1/you/tom:1.0.8
4、再次檢視映象,1.0.8的就被刪除了。
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.0.1/jii/jenkins 1.0.1 3391ef1391f6 18 hours ago 206 MB 192.168.0.1/you/tom 1.0.9 f8ab12e03d53 22 hours ago 276 MB