TL; DR: restart the docker daemon or restart your computer (if you are using it, for example, on a Mac).
Change: Since there are more recent posts below, they answer the question better than mine. Network adapter stuck on daemon. I am updating mine, as it may be at the top of the list and people may not scroll down.
Restarting your docker / docker service / docker-machine daemon is the easiest answer.
best answer (via Shalabha Negi):
docker network inspect <network name> docker network disconnect <network name> <container id/ container name>
It is also faster in real time if you can find the network, since restarting the docker machine / daemon / service is, in my experience, a slow thing. If you use this, please scroll down and press +1 in the answer.
So the problem is probably your network adapter (virtual, docker, not real): take a quick look at this: https://github.com/moby/moby/issues/23302 .
Preventing this again is a bit difficult. There seems to be a problem with the docker when the container exits with the wrong status code (e.g. non-zero) that keeps the network open. Then you cannot start a new container with this endpoint.
Jmons source share