ERROR: error while removing network 解决

ERROR: error while removing network: network cloudservices_default id 757495ac40c7aa62c6797f5fdb852bd80b91d0bb4ebb1bbc46

ded66be03cd3c6 has active endpoints

This is a stale endpoint case. Do you happen to have the error log when that container that was originally removed (which left the endpoint in this state).

BTW, if the container is removed, but the endpoint is still seen, then one can force disconnect the endpoint using docker network disconnect -f {network} {endpoint-name} . You can get the endpoint-name from the docker network inspect {network} command.

github里提问的回答原话

From <https://github.com/moby/moby/issues/17217>

网上的说法是此bug不常见,但是竟然被我碰到了,这个endpoint本来应该已经不存在了,但是不知道什么原因还存在着,二相关的容器已经被移除了。

这时需要用

docker network disconnect -f <container id>  <endpoint name>

来移除相关的endpoint。

Container id:报错是显示的一长串id就是了

Endpoint name: 就是用down命令shut不掉的那些容器的name

此命令需要执行多次,知道所有endpoint被移除为止。

然后只能用docker rm -f 命令来shut 容器, docker-compose down还是无法移除。