本文介绍了创建默认\“ bridge\”时出错网络:无法创建网络(docker0):与网络(docker0)冲突:网络具有相同的网桥名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

停止docker后,它拒绝再次启动。它抱怨称存在另一个名为docker0的网桥:

After stopping docker it refused to start again. It complaint that another bridge called docker0 already exists:

level=warning msg="devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored."
level=info msg="[graphdriver] using prior storage driver \"devicemapper\""
level=info msg="Graph migration to content-addressability took 0.00 seconds"
level=info msg="Firewalld running: false"
level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: cannot create network fa74b0de61a17ffe68b9a8f7c1cd698692fb56f6151a7898d66a30350ca0085f (docker0): conflicts with network bb9e0aab24dd1f4e61f8e7a46d4801875ade36af79d7d868c9a6ddf55070d4d7 (docker0): networks have same bridge name"
docker.service: Main process exited, code=exited, status=1/FAILURE
Failed to start Docker Application Container Engine.
docker.service: Unit entered failed state.
docker.service: Failed with result 'exit-code'.

使用 ip link del docker0 删除网桥

推荐答案

问题似乎出在中/ var / docker / network / 。存储了许多套接字,这些套接字通过其旧ID引用该桥。要解决该问题,您可以删除所有套接字,删除接口,然后启动docker ,但是由于其套接字已消失,您的所有容器都将无法工作。就我而言,我还是不关心无状态容器所以这解决了问题:

The Problem seems to be in /var/docker/network/. There are a lot of sockets stored that reference the bridge by its old id. To solve the Problem you can delete all sockets, delete the interface and then start docker but all your container will refuse to work since their sockets are gone. In my case I did not care about my stateless containers anyway so this fixed the problem:

ip link del docker0
rm -rf /var/docker/network/*
mkdir /var/docker/network/files
systemctl start docker
# delete all containers
docker ps -a | cut -d' ' -f 1 | xargs -n 1 echo docker rm  -f
# recreate all containers

这篇关于创建默认\“ bridge\”时出错网络:无法创建网络(docker0):与网络(docker0)冲突:网络具有相同的网桥名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:47