Docker – How to delete a docker network that does not exist

dockerdocker-swarmnetworkingzombie

I have a docker swarm configuration with 3 nodes. There is a network that sits on only one of the nodes. On that particular node, docker network ls shows the network, docker network rm [network-id] says "Error response from daemon: network … not found" while docker network inspect [network-id] show the network and it looks pretty good (Scope: swarm, Driver: overlay). Exactly like one that i have created test-wise in parallel to compare it with.
Any idea anyone? How can I get rid of that network- zombie?

Best Answer

How can I get rid of that network- zombie?

Please try the following.

docker network inspect <id> or <name>

Under Containers you see all the containers that are still connected to the network

docker network disconnect -f <networkID> <endpointName> or <endpointId> try both

Next remove all unused networks

docker network prune

Fixed the problem for me ;)