我在启动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
答案 0 :(得分:0)
原来我需要为Docker尝试使用的网络启用IP转发,即bridge
网络。
这是通过使用内容
创建文件/etc/systemd/network/bridge.network
来完成的
[Network]
IPFoward=kernel
然后使用systemd-networkd
重新启动# systemctl restart systemd-networkd.service
守护程序。在此之后,# systemctl start docker.service
工作正常。
P.S。重新启动网络守护程序后,我与网络断开连接(正如人们所料)并且必须手动连接。如果你有重要的事情发生,可能值得考虑。
答案 1 :(得分:0)
您的错误文字已被删除,因此我无法检查它是否完全相同,但我收到此错误:
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:
/usr/bin/docker daemon --debug --bip=192.168.y.x/24
其中192.168.y.x是MAIN机器IP,/ 24是ip netmask。 Docker将使用此网络范围来构建网桥和防火墙。 --debug并不是真的需要,但如果其他事情失败可能会有所帮助
开始一次后,你可以杀死码头并像往常一样开始。 AFAIK,docker为这个--bip创建了一个缓存配置,现在应该没有它。当然,如果清理docker缓存,则可能需要再次执行此操作。
答案 2 :(得分:0)
显然是删除
/var/lib/docker/network/files/local-kv.db
在某些情况下可以工作。
来源:https://github.com/moby/moby/issues/18113#issuecomment-161058473
另一种解释可能是使用VPN引起的问题:https://github.com/moby/moby/issues/31546#issuecomment-284196714