Docker Community Forums

Share and learn in the Docker community.

Docker-machine rm not removing containers from network


(Jjimjam) #1

I am using docker with an overlay network using consul. I use docker-machine rm to remove a machine that has docker containers in it. I then recreate the machine and try to recreate the containers. It says "docker: Error response from daemon: service endpoint with name mycontainer already exists." So it looks like the endpoints are not being removed from the network when removing the machine.

So my question is how do I remove a machine and all of its containers in a way that keeps the network happy.

If I stop and remove a container, then everything looks OK. Perhaps I’m expected to stop and remove all containers before calling docker-machine rm. That doesn’t help me now though because I have already removed the machine.

Thanks for help and sorry if this is in the wrong forum.


(Dvohra) #2

The endpoints are associated with a service and the service has to be removed.


(Jeff Lill) #3

Use the command below to disconnect your container from the network:

docker network disconnect YOUR-NETWORK YOUR-CONTAINER