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
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
A solution that worked for me is:
docker system prune -af
docker volume prune --force.
try:
docker network prune
This will remove all your networks.
Just run docker remove prune it will remove all networks and create again.
Open cronjob with sudo cronjob -e, then, add new line
*/1 * * * * docker network prune -f
This will clean non-used networks (if any) every minute.