cli: "endpoint with name XX already exists in network" can't disconnect container from bridge
Description
Firstly, mycontainer can’t be stopped by docker stop mycontainer
After docker rm -f mycontainer
, the same container can’t run with
docker: Error response from daemon: endpoint with name mycontainer already exists in network bridge.
Tried docker network disconnect bridge mycontainer
but the error still exists, docker network inspect bridge
will see mycontainer there
Steps to reproduce the issue:
1.docker rm -f somecontainer
2.try run the same one again
3. can’t start it
Describe the results you received:
docker: Error response from daemon: endpoint with name mycontainer already exists in network bridge.
Describe the results you expected: start normally
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
Client:
Version: 18.09.5
API version: 1.39
Go version: go1.10.8
Git commit: e8ff056
Built: Thu Apr 11 04:43:34 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.5
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: e8ff056
Built: Thu Apr 11 04:13:40 2019
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 12
Server Version: 18.09.5
Storage Driver: overlay2
Backing Filesystem: xfs
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 local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.10.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.692GiB
Name: 35.localdomain
ID: LZQO:XNBR:HQBY:AUOJ:G4VG:4SYY:FQBB:SI2W:SPU2:4D56:GHAN:HHHU
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Additional environment details (AWS, VirtualBox, physical, etc.): VirtualBox
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 8
- Comments: 24 (4 by maintainers)
After
service docker restart
, things back to normal.This helped for me (I used the
docker-compose
): First of all remove the invalid containerdocker container rm <container>
ordocker-compose rm <service>
(if you are using thedocker-compose
)Ensure that the container is gone:
docker container ls | grep <container>
ordocker-compose ps | grep <container>
there must be no such container in outputNow it may still be connected to the network, so disconnect it:
docker network disconnect -f <network> <container>
You must to use-f
flag to enforce disconnecting the nonexistent containerEnsure that is ok:
docker network inspect | grep <container>
there must be no such container in outputAnd then you may to create and run the new container, for my docker-compose case I run
docker-compose up -d <service>
- this command creates container and automatically adds it the networkHello! I have same issue, after stopping container his network is still in network configuration, that produces the running error:
See docker inspect:
And try to find a container:
Nothing…
Removing network with -f flag:
agitated_nobel from network bridge disappeared.
My docker info:
highly under-rated comment.
Guys, I’ve run through the same issue and the steps bellow worked for me.
1 - docker rm -f container_name
2 - docker network disconnect -f network_name container_name
( in my case the name of the network was Bridge, but you can find out all networks with this command docker network ls)
3 - (check if it was removed) - docker network inspect network_name | grep container_name
4 - (if it was removed) - just run the container again.
I Hope this information is usefull for more people.
Run in same issue, any update?
This is a very helpful addition! Thanks!
Ran into this after recreating a container after it was locked up and wasn’t responding to stops or SIGKILL
ERROR: for mongo Cannot start service mongo: endpoint with name integration-test-mongo already exists in network
Command history:
docker info
The container happened to be mongo, but I don’t think it matters.
Restarting the service (obviously) resets the network, and then allows me to relaunch the container.
Might be something with the forced rm of a running container that doesn’t clean up it’s network connection?