Docker删除报错:Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced)(代码片段

Posted 王大雏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker删除报错:Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced)(代码片段相关的知识,希望对你有一定的参考价值。

问题

[root@docker ~]# docker rmi 08b152afcfae
Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced) - image is referenced in multiple repositories

解决办法

强制删除 增加 -f 参数

docker rmi -f 镜像ID

删除成功

[root@docker ~]# docker rmi -f 08b152afcfae
Untagged: nginx:latest
Untagged: nginx@sha256:8f335768880da6baf72b70c701002b45f4932acae8d574dedfddaf967fc3ac90
Untagged: wangdachu/nginx:web
Untagged: wangdachu/nginx@sha256:3f13b4376446cf92b0cb9a5c46ba75d57c41f627c4edb8b635fa47386ea29e20
Deleted: sha256:08b152afcfae220e9709f00767054b824361c742ea03a9fe936271ba520a0a4b
Deleted: sha256:97386f823dd75e356afac10af0def601f2cd86908e3f163fb59780a057198e1b
Deleted: sha256:316cd969204ae854302bc55c610698829c9f23fa6fcd4e0f69afa6f29fedfd68
Deleted: sha256:dcec23d16cb7cdbd725dc0024f38b39fd326066fc59784df92b40fc05ba3728f
Deleted: sha256:1e294000374b3a304c2bfcfe51460aa599237149ed42e3423ac2c3f155f9b4a5
Deleted: sha256:c0d318592b21711dc370e180acd66ad5d42f173d5b58ed315d08b9b09babb84a
Deleted: sha256:814bff7343242acfd20a2c841e041dd57c50f0cf844d4abd2329f78b992197f4
[root@docker ~]# 

补充docker删除命令

1、运行时的删除

[root@docker ~]# docker rmi 08b152afcfae
Error response from daemon: conflict: unable to delete ed603a4c67bb (cannot be forced) 
- image is being used by running container ba0db34470ce
  • 可以看出镜像正在运行中,检查是否有容器正在使用该镜像;
  • 先通过docker-compose down 停止服务;后再次执行删除;

2、删除所有未被 tag 标记和未被容器使用的镜像

[root@docker ~]# docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y

3、删除所有未被容器使用的镜像

docker image prune -a

4、删除所有停止运行的容器

docker container prune

5、删除所有未被挂载的卷

docker volume prune

6、删除所有网络

docker network prune

7、删除 docker 所有资源

docker system prune

以上是关于Docker删除报错:Error response from daemon: conflict: unable to delete 08b152afcfae (must be forced)(代码片段的主要内容,如果未能解决你的问题,请参考以下文章

解决docker删除容器镜像报错Error response from daemon: conflict: unable to delete 7cc1942f1ed5 (must be forced)

删除容器报错:Error response from daemon: conflict: unable to delete

Docker获取镜像报错docker: Error response from daemon

Docker执行错误报错--Error response from daemon: No command specified

docker容器启动报错:Error response from daemon: error creating overlay mount to /var/lib/docker/overlay2/dd

CentOS7 docker报错 /usr/bin/docker-current: Error response from daemon: oci runtime error(需要禁用SELinux)