20

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?

JRoppert
  • 311
  • 1
  • 2
  • 6
  • Does "docker network prune" affect the zombie network? – Johan Feb 16 '19 at 14:17
  • 2
    No it doesnt I do experience the same problem. Can reproduce but not on purpose. Happens after a while. docker network ls shows `id` `name` `overlay` `swarm` but `docker network rm or gives: "Error response from daemon: network `id` not found – Matthis Kohli Mar 11 '19 at 14:05

2 Answers2

23

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 ;)

Matthis Kohli
  • 331
  • 1
  • 5
  • 2
    The container listed in `docker network inspect` isn't in `docker container ls`. But if I do a disconnect with the endpoint name, this seemed to help. – Geoffrey Wiseman May 30 '19 at 03:31
  • 2
    I had to give the --force flag because without it, docker complained that the listed containers didn't exist. – Ryan Fox Jun 12 '19 at 01:16
  • @RyanFox Geoffrey Wieseman I updated my answer. Thank you for the input. We just experienced that we require the or <-f> flag as well sometimes for reasons ... :) – Matthis Kohli Jun 12 '19 at 15:03
  • 1
    nothing worked for me, only a "/etc/init.d/docker restart" removed the zombie network – daigorocub Jul 29 '19 at 09:11
  • 1
    It worked for me, but I had to use the endpointName instead of endpointID – Edouard Berthe Apr 05 '20 at 09:34
  • 2
    Thanks for the help, but although there were actually some containers listed in the containers section after doing `docker network inspect`, the command `docker network disconnect` (even with the `-f` flag and both endpoint name or ID) resulted in an error (the endpoint does not exist). Only a `sudo service docker restart` worked for me. – Edouard Berthe Nov 07 '20 at 18:44
  • I experienced that recently as well but one must admit we have RHEL 7.5 and Docker is quite outdated so more like our fault. – Matthis Kohli Nov 09 '20 at 04:28
0

I ran into a similar issue for my dev environment (unrelated to swarm) while experimenting with connecting containers across docker compose instances. I tried stopping / starting compose, killing containers, removing images, pruning networks, and restarting docker numerous times and in a variety of sequences, yet nothing worked.

Finally I ran the following on the problematic instance while the other compose instances were up, which did work:

docker system prune

This removed (per the warning):

  • all stopped containers
  • all networks not used by at least one container
  • all dangling images
  • all dangling build cache