That all seems to work without errors, and docker node ls shows the swarm:
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
er97lp8ro5wpr5qha8yh8td4f * swarm01 Ready Active Leader
4catt6lqw2bi2vvngqlt4bs4e swarm02 Ready Active Reachable
t7prg842c6xae6xrjim0drpng swarm03 Ready Active Reachable
bm13dlgfa4f78ip80xxbsquy4 swarm04 Ready Active
xyro04ihidkji9v2k0uk53glx swarm05 Ready Active
I then try to deploy a simple container (here I’m using ubuntu, but I tried with various others with the same effect):
docker stack deploy -c docker-compose.yml test
This tries to start the container on each node, but it fails on all of them with an error of:
"starting container failed: No such network: test_default"
Looking in docker network ls seems to show that network does exist:
NETWORK ID NAME DRIVER SCOPE
922b803e55a7 bridge bridge local
60ee96eb1d34 docker_gwbridge bridge local
64b4abf7d243 host host local
qnkqzhpg8cko ingress overlay swarm
cc70ba8a51c8 none null local
r468xyv7rb5l test_default overlay swarm
This is using Docker version 17.10.0-ce, build f4ffd25
Got my case fixed as it turned out to be related to the defined container having issues on its own preventing it from starting properly. After fixing several aspects with testing the container as such prior to embedding it into some stack I got it running eventually in the very same swarm I was using before. So, AFAIC this error message seems to be misleading.
I’m having a similar issue with a Docker Stack. I rebooted the server and one of my services doesn’t start and the error in the service status is “no such network” as described above.
I can run docker service scale service_name=0 wait a few seconds and then scale it back to 1 and the service starts up fine. This is an easy fix, but kind of terrible to have to go through this.
Any ideas?
$ docker --version
Docker version 17.09.0-ce, build afdb6d4
Good find @llitfkitfk, thank you! I verified that 17.11 does, indeed, fix the issue. I added the following to /etc/apt/sources.list.d/docker.list:
deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial edge
Per the edge instructions, I stopped all my containers by scaling my services down to 0 prior to installation, then apt-get update and apt-get upgrade, and scaled services back up. Once everything was running again, I rebooted to ensure all my services started as expected.