Docker守护程序无法初始化网络控制器

gkn4icbw  于 2023-01-29  发布在  Docker
关注(0)|答案(4)|浏览(136)

我在启动我的docker守护进程时遇到问题。我已经安装了docker,但当我尝试运行# systemctl start docker.service时,它抛出了一个错误。$ systemctl status docker.service给我这个:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-09-21 14:38:24 CEST; 6s ago
     Docs: https://docs.docker.com
  Process: 5592 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 5592 (code=exited, status=1/FAILURE)

Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.271068176+02:00" level=warning msg="devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored."
Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.327814644+02:00" level=info msg="[graphdriver] using prior storage driver \"devicemapper\""
Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.329895994+02:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.330707721+02:00" level=info msg="Loading containers: start."
Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.335610867+02:00" level=info msg="Firewalld running: false"
Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.461243263+02:00" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: failed to parse pool request for ad
Sep 21 14:38:24 tp-x230 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Sep 21 14:38:24 tp-x230 systemd[1]: Failed to start Docker Application Container Engine.
Sep 21 14:38:24 tp-x230 systemd[1]: docker.service: Unit entered failed state.
Sep 21 14:38:24 tp-x230 systemd[1]: docker.service: Failed with result 'exit-code'.

相关行为:

Sep 21 14:38:24 tp-x230 dockerd[5592]: time="2016-09-21T14:38:24.461243263+02:00" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: failed to parse pool request for ad
j91ykkif

j91ykkif1#

您的错误文本被剪切,所以我无法检查它是否是完全相同的错误,但我得到了这个错误:

Error starting daemon: Error initializing network controller: Error creating default "bridge" network: failed to parse pool request for address space "LocalDefault" pool "" subpool "": could not find an available predefined network

这是与机器有几个网卡(也可能发生在机器与VPN,你也可以暂时停止它,启动Docker和重新启动VPN或应用以下变通方案)
对我来说,解决方案是手动启动Docker,如下所示:

/usr/bin/docker daemon --debug --bip=192.168.y.x/24

其中,192.168.y.x是MAIN计算机IP,/24是该IP的网络掩码。Docker将使用此网络范围构建网桥和防火墙文件。实际上并不需要--debug,但在其他程序失败时可能会有所帮助
启动一次后,你可以关闭docker并像往常一样启动。AFAIK,docker已经为那个--bip创建了一个缓存配置,现在应该可以不使用它工作了。当然,如果你清理了docker缓存,你可能需要再做一次。

83qze16e

83qze16e2#

https://github.com/microsoft/WSL/issues/6655开始,这对我很有效

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

sudo dockerd &
f0brbegy

f0brbegy3#

显然,删除/var/lib/docker/network/files/local-kv.db在某些情况下可以工作。
图片来源:www.example.comhttps://github.com/moby/moby/issues/18113#issuecomment-161058473
另一种解释可能是使用VPN导致的问题:www.example.comhttps://github.com/moby/moby/issues/31546#issuecomment-284196714

9jyewag0

9jyewag04#

原来我需要为Docker试图使用的网络启用IP转发,即bridge网络。
这是通过创建包含以下内容的文件/etc/systemd/network/bridge.network来完成的

[Network]

IPFoward=kernel

然后使用# systemctl restart systemd-networkd.service重新启动systemd-networkd守护进程。在此之后,# systemctl start docker.service工作正常。
P.S.重新启动网络守护程序后,我的网络断开了(正如人们所料),不得不手动连接。如果你有重要的事情要做,可能值得考虑一下。

相关问题