错误:根据名称找到2个匹配项:network officeconverter_default不明确

问题描述

我正在使用命令构建docker图像

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

但是它返回了一个错误

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

这很明显,我的机器中有两个名称相同的网络试图存在。

问题是如何从docker网络中删除网络

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

解决方法

试试: docker network prune

这将删除您的所有网络。

,

解决方案很简单!

只需删除网络即可。

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
,

对我有用的解决方案是:

docker system prune -af
docker volume prune --force