docker - 来自守护进程 : conflict: unable to delete 2602b4852593 (cannot be forced) - image has dependent child images 的错误响应

标签 docker

我无法删除 docker 图像。低于错误。

docker image rm -f $(docker image ls -aq)
Error response from daemon: conflict: unable to delete 6ab53ec1a8c9 (cannot be forced) - image is being used by running container d65f1c6b7982
Error response from daemon: conflict: unable to delete 2602b4852593 (cannot be forced) - image has dependent child images

Docker 版本:
docker --version
Docker version 17.05.0-ce, build 89658be

最佳答案

问题

Error response from daemon: conflict: unable to delete 6ab53ec1a8c9 (cannot be forced) - image is being used by running container d65f1c6b798



正如消息所说,您有一个容器正在运行,该容器使用您尝试删除的图像,因此出现错误。

您可以停止容器,然后再次运行该命令,但存在更好的方法...

更好的方式

docker image rm -f $(docker image ls -aq)



您现在可以使用,而不是使用过去的上述 hack:
docker image prune -a

旗帜-a将删除所有未使用的 docker 镜像,这意味着不会触及正在运行的容器使用的镜像,因此这可能是您想要使用的以实现您想要做的事情。

它的帮助:
docker image prune --help                                                                                                                                                                                 
Usage:  docker image prune [OPTIONS]

Remove unused images

Options:
  -a, --all             Remove all unused images, not just dangling ones
      --filter filter   Provide filter values (e.g. 'until=<timestamp>')
  -f, --force           Do not prompt for confirmation

关于docker - 来自守护进程 : conflict: unable to delete 2602b4852593 (cannot be forced) - image has dependent child images 的错误响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54480752/

相关文章:

node.js - Docker (compose) 和套接字 io - 如何链接容器

node.js - 用于容器的 Azure Web 应用程序 - 启动期间失败 - 未响应 HTTP ping

postgresql - 从 Debian Docker 容器连接到 Windows Postgres

docker - 如何从独立容器连接到 Docker Compose 容器

Docker 未知标志 : --network

php - Xdebug使PHP太慢了

docker - VSCode : How to run a Jupyter notebook in a docker container, 通过远程服务器?

docker - pod 容器无法解析运行它的主机

windows - docker 代理拉窗口 10

node.js - Docker利用了几个基础镜像