Docker Community Forums

Share and learn in the Docker community.

Error while removing network: network ... has active endpoints

I have a system with several docker-compose containers and networks. Occasionally, when we do a docker-compose down, it fails with the error:
ERROR: error while removing network: network broker_net-conquest id 94bc69b11c077471717c2d2ab457d5e4010086ba80ad528cc4cc03772bc1da37 has active endpoints
But, if I try to find the container with the active endpoint, there are none:

# docker inspect broker_net-conquest [ { "Name": "broker_net-conquest", "Id": "94bc69b11c077471717c2d2ab457d5e4010086ba80ad528cc4cc03772bc1da37", "Created": "2021-05-14T19:12:16.253503798Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.27.0.0/16", "Gateway": "172.27.0.1" } ] }, "Internal": false, "Attachable": true, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, **"Containers": {},** "Options": {}, "Labels": { "com.docker.compose.network": "net-conquest", "com.docker.compose.project": "broker", "com.docker.compose.version": "1.28.6" } } ]

In fact, there are no containers running:

# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

To get out of this state, we need to restart the docker service. Not something we really want to do in a production system.

Any ideas?