Solved: Error while deleting docker network

When you try to delete a network you may get the below error.
C:\>docker network rm network_name
Eresponse from daemon: network network_name has active endpoints
This error comes when you have an active endpoint. First you have to inspect the network to check if any container is still running which is using the network.
docker inspect network_name
Check running containers using
docker container ls
If you find any container running which is using the network that you are trying to delete, you will have to first stop and remove that container. Be sure that you don’t need that container.
docker stop container_name
docker rm container_name
If you don’t see any container running with the name given in the inspect output. Than it means that the container that you deleted earlier was not removed properly and it has traces remaining in network.
To remove the endpoint from network run this command.
docker network disconnect --force network_name container_name
Finally you should be able to remove the network now.
docker network rm network_name

No comments:

Post a Comment