Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: 2 matches found based on name: network <nameofservice>_default is ambiguous

I was building docker image using the command

docker-compose -f "docker-compose.yml" up -d --build 

But it returns me an error

ERROR: 2 matches found based on name: network officeconverter_default is ambiguous

This is a bit clear that in my machine there are two networks with the same name trying to exists.

Question is how to remove the networks from docker networks

PS E:\repos\Github\officeconverter> docker network ls
NETWORK ID          NAME                        DRIVER              SCOPE
868c88a83bd6        bridge                      bridge              local
92f7d20ed432        officeconverter_default     bridge              local
3f96cfb7b591        officeconverter_default     bridge              local

like image 234
Dupinder Singh Avatar asked Sep 07 '20 11:09

Dupinder Singh


3 Answers

The solution is simple!

just remove the networks.

like docker network rm <network Id> <space> <network Id> ....

PS E:\repos\Github\officeconverter> docker network rm 92f7d20ed432 3f96cfb7b591
92f7d20ed432
3f96cfb7b591
PS E:\repos\Github\officeconverter> docker network ls
NETWORK ID          NAME                        DRIVER              SCOPE
868c88a83bd6        bridge                      bridge              local
like image 149
Dupinder Singh Avatar answered Oct 19 '22 17:10

Dupinder Singh


try: docker network prune

This will remove all your networks.

like image 43
baumannalexj Avatar answered Oct 19 '22 19:10

baumannalexj


A solution that worked for me is:

docker system prune -af
docker volume prune --force.

like image 2
claudius Avatar answered Oct 19 '22 19:10

claudius