Docker daemon can't initialize network controller
Asked Answered
C

6

17

I'm having trouble starting my docker daemon. I've installed docker but when I try to run # systemctl start docker.service it throws an error. $ systemctl status docker.service gives me this:

● 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'.

with the relevant line being:

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
Chafe answered 21/9, 2016 at 13:4 Comment(0)
S
19

This worked for me, from 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 &
Sisak answered 5/9, 2022 at 2:6 Comment(1)
This worked for me. More details in the answer here : forums.docker.com/t/…Starspangled
K
11

Your error text was cut, so i can not check if it is exactly the same error, but i got this error:

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

This was related to the machine having several network cards (can also happen in machines with VPN, you can also temporarily stop it, start docker and restart the vpn OR apply the below workaround)

To me, the solution was to start manually docker like this:

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

where the 192.168.y.x is the MAIN machine IP and /24 that ip netmask. Docker will use this network range for building the bridge and firewall riles. The --debug is not really needed, but might help if something else fails

After starting once, you can kill the docker and start as usual. AFAIK, docker have created a cache config for that --bip and should work now without it. Of course, if you clean the docker cache, you may need to do this again.

Kolva answered 26/9, 2016 at 16:5 Comment(4)
Thanks, VPN was the issueDouty
colab: can't initialize iptables table `nat': Permission denied (you must be root)Suzansuzann
unknown flag: --bipKetchum
@PeterlitsZo, new docker versions seem to move the cli option to the daemon.json config directly: docs.docker.com/network/drivers/bridge/…Kolva
Y
3

Apparently deleting /var/lib/docker/network/files/local-kv.db could work in some cases.

Source: https://github.com/moby/moby/issues/18113#issuecomment-161058473

Another explanation could be problem caused by using VPN: https://github.com/moby/moby/issues/31546#issuecomment-284196714

Yusem answered 13/12, 2018 at 13:30 Comment(0)
H
3

In my case, the error occurred because I was running wsl version 1 intead of 2

To update wsl to version 2, run wsl --set-version <distro name> 2 replacing with the name of the Linux distribution that you want to update.

For example, wsl --set-version Ubuntu-18.04 2 will set your Ubuntu 18.04 distribution to use WSL 2

Horoscope answered 17/5, 2023 at 12:36 Comment(1)
Thanks man, that worked for me. Daemon wasn't starting on any way.Xenon
C
2

Turns out I needed to enable IP forwarding for the network that Docker was trying to use, namely the bridge network.

This was done by creating the file /etc/systemd/network/bridge.network with the content

[Network]

IPFoward=kernel

and then restarting the systemd-networkd daemon with # systemctl restart systemd-networkd.service. After this, # systemctl start docker.service worked fine.

P.S. After restarting the network daemon, I was disconnected from my network (as one might expect) and had to manually connect. Might be worth considering if you've got something important going on.

Chafe answered 21/9, 2016 at 13:4 Comment(1)
Maybe executing the following command needed: $ifdown [interface] && ifup [interface]Gally
H
0

I was getting similar error as below:

failed to start daemon: Error initializing network controller: error obtaining controller instance: invalid pools size: 0

By adding size in /etc/docker/daemon.json file, it got resolved.

from:

xxx@dev:~$ cat /etc/docker/daemon.json
{
  "bip": "10.0.0.1/24",
  "dns-search": ["xyz.abc.com", "abc.com"],
  "insecure-registries": ["pqr.xyz.abc.com", "localhost:5000"],
  "default-address-pools": [{"base":"10.254.0.0/24"}]
}

to

xxx@dev:~$ cat /etc/docker/daemon.json
{
  "bip": "10.0.0.1/24",
  "dns-search": ["xyz.abc.com", "abc.com"],
  "insecure-registries": ["pqr.xyz.abc.com", "localhost:5000"],
  "default-address-pools": [{"base":"10.254.0.0/24","size":24}]   <<<<< here
}
Hydraulic answered 17/4 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.