moby: docker network rm `networkname` has error has active endpoints
Description when running
$ docker network rm new-mail_develop_default
error response from daemon: error while removing network: network new-mail_develop_default id 469e10dee4acb100fb868d7709bd83c75beeded79962cc574d47976495668d89 has active endpoints
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
1183956ec66a bridge bridge local
1c98ceffa4d4 host host local
469e10dee4ac new-mail_develop_default bridge local
4826ed19a910 none null local
$ docker network inspect new-mail_develop_default
[
{
"Name": "new-mail_develop_default",
"Id": "469e10dee4acb100fb868d7709bd83c75beeded79962cc574d47976495668d89",
"Created": "2021-03-08T12:28:54.020954486+03:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.0.0/20",
"Gateway": "192.168.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "new-mail_develop",
"com.docker.compose.version": "1.27.4"
}
}
]
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Steps to reproduce the issue:
- Cannot be reproduce special case
Describe the results you received: remove network
Describe the results you expected: remove network
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
Docker version 20.10.3, build 48d30b5
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 72
Server Version: 20.10.3
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.15.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.51GiB
Name: up-jenkins01.pusula.net.tr
ID: TAN6:P6A4:CLRY:GP46:6CLZ:RBUT:YO3V:I2AF:YXRB:26ON:UX3D:ZJYC
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.): proxmox
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 21
- Comments: 20 (2 by maintainers)
Commits related to this issue
- tests: do not use docker volumes Why: * This bug happens infrequently: https://github.com/moby/moby/issues/42119 * This causes networks to not be removed at the end of a test. * This causes volumes ... — committed to wazo-platform/wazo-setupd by sduthil 3 years ago
- Merge pull request #42 from wazo-platform/tests-without-volumes tests: do not use docker volumes Why: This bug happens infrequently: moby/moby#42119 This causes networks to not be removed at the en... — committed to wazo-platform/wazo-setupd by wazo-community-zuul[bot] 3 years ago
We have the same issue on a non proxmox environment
while no container is attached
and not even a single container exists
Seems to be happening with the new docker engine, 18.xx seems to work just fine. Fairly blocking since it reoccurs frequently.
There is no way to fix this issue besides restarting the docker-engine itself. We neither can do either of this
docker network prune --force
docker network rm testing_default
@sonersivri you should probably rename the issue to include ‘while no containers exist’ because there are a couple of other issues with ‘still active endpoints’ which actually have attached containes - which we do not have here and that should be an important difference
docker --version Docker version 20.10.7, build f0df350
on Ubuntu 18.04.5
Restating the daemon works
Just happened to me as well. I solved it by restarting docker service, I can do that right now since this is a new server setup but wont be able to in the future once we have services running.
@jest: Thanks for the detailed look into it. I also had the hunch, that is was tracking the number of containers in the network via some variable which it fails to decrement to zero and then it refuses to remove the container because it only checks that value at that point.
I also think there are concurrent database accesses which mess up that value resulting in an inconsistency.
You are also correct that this issue exists for quite some time already. You can find people all over the internet running into it and the only “solution” is to restart
dockerd
…Maybe with your detailed information someone is willing to dig into it and find the offending database interactions.
Some other workaround that I have found:
We are doing this for 6 weeks now and haven’t hit the bug again. We might be lucky, or this is another workaround without shutting down
dockerd
.We’re seeing this same issue as well with docker 20.10.5. We have a CI/CD that is spawning hundreds of dockers and with docker 19.03 we never had issues with “docker-compose down” reporting active endpoints. We recently upgraded to docker 20.10.5 and we’re hitting this problem tens of times per day on that CI/CD pipeline.
Let me know if there’s any log I can collect to help debugging this issue.