1. 程式人生 > >Docker刪除鏡像報錯

Docker刪除鏡像報錯

conflict agg ref nginx conf delete mage 解決 area

問題描述:

筆者意圖刪除nginx-file的鏡像文件,但通過命令刪除鏡像時出現報錯信息,提示存在多個引用(即一個IMAGE可被多個REPOSITORY引用,故刪除會出現失敗),如下:

[root@kazihuo ~]# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
kazihuo/nginx       v1                60c22883bb42        6 minutes ago       372 MB
nginx
-file v1 60c22883bb42 6 minutes ago 372 MB

[root@kazihuo ~]# docker rmi 60c22883bb42

Error response from daemon: conflict: unable to delete 60c22883bb42 (must be forced) - image is referenced in multiple repositories

解決方案:

當指定IMAGE ID刪除報錯時,可直接通過REPOSITORY:

TAG的方式刪除;

[root@kazihuo ~]# docker rmi nginx-file:v1

Untagged: nginx-file:v1

[root@kazihuo ~]# docker images

REPOSITORY       TAG                 IMAGE ID            CREATED             SIZE

kazihuo/nginx    v1                  60c22883bb42       11 minutes ago      372 MB

Docker刪除鏡像報錯