创建默认\" bridge \"时出错网络:无法创建网络(docker0):与网络冲突(docker0):网络具有相同的网桥名称

时间:2016-11-10 09:57:32

标签: docker

停止码头后,它拒绝再次启动。它抱怨另一个名为docker0的桥已经存在:

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删除网桥,然后启动docker会导致与另一个ID相同的结果。

2 个答案:

答案 0 :(得分:9)

对我来说,我降级了我的操作系统(在这种情况下为Centos Atomic Host)并遇到了此错误消息。较旧的Centos Atomic的码头是1.9.1。在运行降级之前,我没有运行任何正在运行的docker容器或图像。

我只是跑了下面,码头工人又开心了:

sudo rm -rf /var/lib/docker/network
sudo systemctl start docker

More info.

答案 1 :(得分:2)

问题似乎出现在/var/docker/network/中。存储了很多套接字,它通过旧的id引用桥。要解决问题,您可以删除所有套接字,删除接口,然后启动docker 但是所有容器都会因为套接字消失而拒绝工作。在我的情况下,我不关心我的无状态容器所以这解决了问题:

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