moby: Cannot remove network due to task
Description
Steps to reproduce the issue:
- create network with this command: docker network create --attachable --driver overlay cluster-network
- run a couple of service in swarm mode and delete all services
- trying to delete network: docker network rm cluster-network
Describe the results you received: docker network rm cluster-network Error response from daemon: rpc error: code = 9 desc = network qytxrqgp7pw1915tqhdnkd4si is in use by task 8ruj7pjh65g9du0m1y7ce476i
Describe the results you expected: Want to delete network with proper descritpion. what is the task?
Additional information you deem important (e.g. issue happens only occasionally):
docker network inspect cluster-network
[
{
"Name": "cluster-network",
"Id": "qytxrqgp7pw1915tqhdnkd4si",
"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": "4097"
},
"Labels": null
}
]
Output of docker version
:
Client:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:58:26 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.0
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:58:26 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 129
Server Version: 1.13.0
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 106
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: active
NodeID: 7tri47t51271szj46y1sysjcf
Is Manager: true
ClusterID: 8jnswr0kvdlavkn0puuuhljxd
Managers: 3
Nodes: 6
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: 192.168.0.27
Manager Addresses:
192.168.0.27:2377
192.168.0.32:2377
192.168.0.33:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-62-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.953 GiB
Name: mngr01
ID: YNJP:5BEI:W4UN:NPUK:EJ3R:CYBC:RBMW:GO2Q:ASJA:PDTT:TZBK:CYWQ
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
Additional environment details (AWS, VirtualBox, physical, etc.): VMware vshpere, ubuntu16.04 host
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 7
- Comments: 48 (9 by maintainers)
I had to restart the docker daemon on the swarm master to get rid of the task
systemctl restart docker
Thendocker network rm <network-id>
Decided to tackle with this on my home computer, and seems like that I can reproduce this with the latest versions and also in a new freshly installed docker. I try to write some MVP reproducible script for debugging this, since currently I’m not entirely sure if there is something funky happening in the container itself or is this related to somewhere else.
Sorry @thaJeztah I missed your comment. Yes, the task is not defined on any of our manager nodes; it seems to simply not exist. We can’t inspect tasks from worker nodes but have confirmed that the
rates_default
network doesn’t extend to any of them.Right now our only workaround has been to deploy our stack to a second
rates2_default
network and update all of our references – therates_default
orphan is still unable to be removed.Update: my bad, actually, I had a container (not started with
service create
) running attached to the network (the network has--attachable
set). So in my case it actually was a problem of communicating that a task was attached to the network while it was only a normal container.Experiencing here as well - Server Version: 17.05.0-ce-rc1 in docker-for-awsNote that I removed all the services and then inspecting the task gives me:
I’m experiencing same issue running
17.03.0-ce
Issue still persists in 20.10.8. Currently we restart the docker daemons and that will allow us to remove the network. Really only useful in testing and is no real solution long term.
Been having occasionally the same issue when working with stacks. I can reproduce this when running script that starts swarm stack and then connects few containers to this stack’s network. This issue rises when I CTRL-c out of this script after stack has been created and maybe one or two container has been connected to the stack’s network.
After CTRL-c, I can then prune everything related to stack and these spawned containers, but just can’t delete the network even though there are no containers or services running related to it. I can write a minimal script for helping to debug this, but since this occurs on a work-related script I need to rewrite something similar.
Necessary info:
I have same issue in Docker 18.06 ((