moby: Docker stack Error response from daemon: network *_default not found
Description
Docker is unable to deploy a simple stack, reporting “Error response from daemon: network myapp_default not found”
Steps to reproduce the issue:
- Create overlay attachable network mynet
$docker network create --attachable --driver overlay mynet
kc9u8lgi1yugpudo5qk6o2g58
$docker network inspect mynet
[
{
"Name": "mynet",
"Id": "kc9u8lgi1yugpudo5qk6o2g58",
"Created": "0001-01-01T00:00:00Z",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": []
},
"Internal": false,
"Attachable": true,
"Containers": null,
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4098"
},
"Labels": null
}
]
- Write stack.yml compose-file
$cat stack.yml
version: "3"
networks:
default:
external:
name: mynet
services:
elasticsearch:
command: "elasticsearch -E cluster.name=myapp -E node.name=elasticsearch -E discovery.zen.ping.unicast.hosts=elasticsearch"
#hostname: "{{.Service.Name}}-{{.Task.Slot}}"
image: "elasticsearch:5.2.1"
#ulimits:
# memlock: -1
# nofile: 65536
# nproc: 2048
- Run docker stack deploy command
$docker stack deploy --compose-file stack.yml myapp
Creating service myapp_elasticsearch
Error response from daemon: network myapp_default not found
Describe the results you received:
Creating service myapp_elasticsearch Error response from daemon: network myapp_default not found
Describe the results you expected:
A simple elasticsearch stack being deployed
Output of docker version
:
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:50:14 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:50:14 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 7
Running: 6
Paused: 0
Stopped: 1
Images: 42
Server Version: 1.13.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 116
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: active
NodeID: ph56dmuj9xyp7v0mxngpi4wmg
Is Manager: true
ClusterID: jmdwt0h7bwcobihnfignepzwr
Managers: 1
Nodes: 1
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
Node Address: 155.54.212.5
Manager Addresses:
155.54.212.5:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-21-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.4 GiB
Name: computer
ID: E4N3:47NS:3QGR:EWSK:L4ZR:RWXL:JJXE:U53F:4NIU:N6XK:6OVD:WY4C
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 22 (3 by maintainers)
I’ve had this issue too when removing a stack, with docker stack rm, the network lingers for about 10 seconds before it’s finally removed. So, if I call docker stack deploy, with the same stack name that I just removed, in that timeframe I get the above error too.
@w7089, thank you, your answer helped to me. Just want to point that systemctl have command
restart
, sois enough 😃
Having the same issue with 17.10.0-ce Another issue was that some containers in output of:
were in status:
So restarting each docker daemon in the swarm helped:
Today I’ve got same issue. I had stack deployed on node1 (leader) and I was logged in on node3 (reacheable, but not actually leader). Then I called
docker stack rm
on node3 and tried to create stack onnode1
again - and got same error. I’ve tried several times - nothing happens. And now I see:on
node3
:on
node1
:and I can’t remove this network from
node3
:Any idea on the root cause of this?
systemctl restart docker
isn’t really a scalable solution.Thank you @w7089 & @romash1408 it helps me a lot.
I encounter this error with docker version 17.09.0-ce with a really simple stack deploy. The deploy not even declares network.
Actually typing that up got me thinking and I think I can reliably reproduce it. If I delete the stack with
stack rm
and then run adocker-compose run
command which creates the networks. Later on when I go to create the stack it has an error because it can’t create the network(s) since some already exist with the same name.The issue is caused by attempting to start the stack before the old network has finished removing, you can work around this by explicitly polling and waiting for the network to be removed: https://github.com/moby/moby/issues/29293#issuecomment-318852549
@g0t4 That’s seems another issue: https://github.com/docker/docker/issues/29293