Getting "no such network" errors starting a stack in a swarm

I’m trying to build a test lab on my local Ubuntu 17.10 machine using VirtualBox docker hosts.

I set up a bunch of hosts using docker-machine:

docker-machine create --driver virtualbox swarm01
docker-machine create --driver virtualbox swarm02
docker-machine create --driver virtualbox swarm03
docker-machine create --driver virtualbox swarm04
docker-machine create --driver virtualbox swarm05

And then created a stack

eval $(docker-machine env swarm01)
docker swarm init --advertise-addr $(docker-machine ip swarm01)
eval $(docker-machine env swarm02) && $(docker swarm join-token manager | grep docker)
eval $(docker-machine env swarm03) && $(docker swarm join-token manager | grep docker)
eval $(docker-machine env swarm04) && $(docker swarm join-token worker | grep docker)
eval $(docker-machine env swarm05) && $(docker swarm join-token worker | grep docker)

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

I am encountering the same issue. Service does not start due to network missing, though it is listed.

Any progress?

Info on my test installation of docker swarm:

Containers: 93
 Running: 0
 Paused: 0
 Stopped: 93
Images: 10
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: cpsi2ewjcx7qlu2lpjw9fsb2h
 Is Manager: true
 ClusterID: b8dke0zbjde7dl2k0eqe9roib
 Managers: 3
 Nodes: 3
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 94.130.185.164
 Manager Addresses:
  138.201.189.209:2377
  88.99.123.129:2377
  94.130.185.164:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-98-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.906GiB
Name: node1
ID: CYRF:X6MJ:UJK3:LDQ5:VAHJ:XNRP:ONEM:WUPM:A7MD:A65U:XFZO:6I6G
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: soletan
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

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
1 Like

same issue

I think we need wait for the next release


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.