moby: Docker fails to create network bridge on start up

Description of problem: When freshly installing the docker 1.9.0 daemon, it sometimes fails to create the network bridge at startup and thus fails to start the daemon. It seems to fail about 50% of the time and I’m not sure why. Here’s some of the log output:

time="2015-11-20T05:32:35.395996380Z" level=info msg="API listen on /var/run/docker.sock" 
time="2015-11-20T05:32:35.415570660Z" level=info msg="Firewalld running: false" 
time="2015-11-20T05:32:35.441312772Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.1/16. Daemon option --bip can be used to set a preferred IP address" 
time="2015-11-20T05:32:35.445369505Z" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: failed to allocate gateway (172.17.0.1): No available addresses on this pool" 
time="2015-11-20T05:32:35.562979814Z" level=info msg="API listen on /var/run/docker.sock" 
time="2015-11-20T05:32:35.581794400Z" level=info msg="Firewalld running: false" 
time="2015-11-20T05:32:35.672030288Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.1/16. Daemon option --bip can be used to set a preferred IP address" 
time="2015-11-20T05:32:35.677536533Z" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: failed to allocate gateway (172.17.0.1): No available addresses on this pool" 

docker version:

Client:
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   76d6bc9
 Built:        Tue Nov  3 17:43:42 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

docker info:

Containers: 0
Images: 0
Server Version: 1.9.0
Storage Driver: overlay
 Backing Filesystem: extfs
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.2.0-18-generic
Operating System: Ubuntu 14.04.3 LTS
CPUs: 1
Total Memory: 2.045 GiB
Name: vagrant
ID: 253M:O5XT:BJQK:AHRB:U5MI:OQZL:UUK4:YZAR:6XIH:XHV2:62QQ:3BET
WARNING: No swap limit support

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

uname -a: Linux default-ubuntu-1404 4.2.0-18-generic #22~14.04.1-Ubuntu SMP Fri Nov 6 22:20:11 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.): I’ve ran into this issue on both AWS and Virtualbox with the latest ubuntu 14.04 images with the linux-virtual-lts-wily kernels installed (4.2.0)

How reproducible: It seems to be about a 50% chance that the install will fail due to not being able to create the network bridge interface at start up

Steps to Reproduce:

  1. Install the linux-virtual-lts-wily package onto an ubuntu 14.04 virtual box or AWS server
  2. Install Docker 1.9.0, and enable the daemon with -s overlay
  3. Sometimes it will fail, sometimes it will succeed

Actual Results: Docker does not run

Expected Results: Docker daemon should be running

Additional info: I dont get this error if I use the linux-virtual-lts-vivid kernel (3.19) instead.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 74 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@Chili-Man @dvanbuskirk @sheldonkwok When you experience the issue, can you please copy your /var/lib/docker/network/files/local-kv.db in some place where I can download it. I want to take a look at it.

A possible work-around, please check, could be delete that file before starting the daemon.

Deleting /var/lib/docker/network/files/local-kv.db worked for me

Docker on production system (ubuntu 14.04) not working anymore 😦

docker daemon INFO[0000] [graphdriver] using prior storage driver “aufs” INFO[0000] Graph migration to content-addressability took 0.01 seconds INFO[0000] Firewalld running: false FATA[0000] 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

Tried to delete the files. Did not work. manual start throws the error above. Any ideas or workarounds out there? Can i downgrade to a specific version and how?

Docker version 1.10.3, build 20f81dd

ii  docker-engine                       1.10.3-0~trusty                  amd64        Docker: the open-source application container engine

edit: By the way a very disturbing bug for a stable release 😉

Last upgrade in apt.log:

Start-Date: 2016-04-06 06:49:08 Install: linux-image-extra-3.13.0-85-generic:amd64 (3.13.0-85.129, automatic), linux-image-3.13.0-85-generic:amd64 (3.13.0-85.129, automatic), linux-headers-3.13.0-85-generic:amd64 (3.13.0-85.129, automatic), linux-headers-3.13.0-85:amd64 (3.13.0-85.129, automatic) Upgrade: linux-headers-generic:amd64 (3.13.0.83.89, 3.13.0.85.91), linux-image-generic:amd64 (3.13.0.83.89, 3.13.0.85.91), linux-generic:amd64 (3.13.0.83.89, 3.13.0.85.91) End-Date: 2016-04-06 06:50:09

-> Was getting active with a restart today (i think)

edit again: Tried with 3.13.0-83-generic and it still fails.

docker daemon --debug
DEBU[0000] docker group found. gid: 999
DEBU[0000] Server created for HTTP on unix (/var/run/docker.sock)
DEBU[0000] Using default logging driver json-file
INFO[0000] [graphdriver] using prior storage driver "aufs"
DEBU[0000] Using graph driver aufs
INFO[0000] Graph migration to content-addressability took 0.01 seconds
DEBU[0000] Option DefaultDriver: bridge
DEBU[0000] Option DefaultNetwork: bridge
INFO[0000] Firewalld running: false
DEBU[0000] /sbin/iptables, [--wait -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL -j DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t nat -D PREROUTING]
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT]
DEBU[0000] /sbin/iptables, [--wait -t nat -F DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t nat -X DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -F DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -X DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -F DOCKER-ISOLATION]
DEBU[0000] /sbin/iptables, [--wait -t filter -X DOCKER-ISOLATION]
DEBU[0000] /sbin/iptables, [--wait -t nat -n -L DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t nat -N DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -n -L DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -N DOCKER]
DEBU[0000] /sbin/iptables, [--wait -t filter -n -L DOCKER-ISOLATION]
DEBU[0000] /sbin/iptables, [--wait -t filter -N DOCKER-ISOLATION]
DEBU[0000] /sbin/iptables, [--wait -t filter -C DOCKER-ISOLATION -j RETURN]
DEBU[0000] /sbin/iptables, [--wait -I DOCKER-ISOLATION -j RETURN]
DEBU[0000] Registering ipam driver: "default"
DEBU[0000] Allocating IPv4 pools for network bridge (5ddf865f82ce3b7ef483e27822a8c0d2b560f38f0fc9d4c4d02c60c79ea7d6f7)
DEBU[0000] RequestPool(LocalDefault, , , map[], false)
DEBU[0000] Cleaning up old shm/mqueue mounts: start.
FATA[0000] 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

Tried to reinstall docker with apt-get remove --purge docker-engine Then reinstalled docker-engine after a reboot.

EDit: Tried to remove /var/lib/docker -> still fails Edit: Tried to modprobe -r bridge -> still fails

WORKAROUND: Added in /etc/default/docker: DOCKER_OPTS=“–bip=172.17.42.1/16”

@Chili-Man this seems like a dupe of https://github.com/docker/docker/issues/17939. Can you pls make sure if there are multiple docker daemons running (either natively in the host or via dind using the same root directory as indicated in https://github.com/docker/docker/issues/17939).

  • sudo rm -rf /var/lib/docker – destroy all Docker internal files (sometimes Docker gets into an invalid state and, unfortunately, this is the only way to correct it)

  • sudo systemctl restart docker - restart the Docker system service (turn it off and turn it back on

will fix it

@aboch, I just hit this issue when upgrading our 1.9.0 machines to 1.9.1 on Ubuntu 14.04.

“Fix” was to delete the:

/var/lib/docker/network/files/local-kv.db file.

If you guys need another local-kv.db file to look at, I can send it to you.

As there are several tickets written by people claming that IPv6 is broken, here is the solution how to configure it corretly. Someone should change the documentation accordingly.

Docker IPv6 is working perfectly, it’s just the documentation that doesn’t tell people what to do in order to set it up correctly.

Docker will not do SLAAC (Stateless Address Autoconfiguration), nor will it use DHCPv6. As it also won’t do NATv6 (thank god!), you will have to assign ipv6 prefixes to your networks manually. The default bridge network has to be assigned a network, you can do this by adding the following to daemon.json:

{
"ipv6": true,
"fixed-cidr-v6": "2001:db8::/64",
}

For any other network you might have, you can decide wether or not it will be ipv6 capable. To create an IPv6 capable network, do the following: docker network create --ipv6 --subnet "2001:db8:1::/64" testnet

Also remember, that this is not NATv6 (thank god!). Therefor you will have to have a route from your router to your docker host!

I was experiencing the same problem. Removing /var/lib/docker/network/files/local-kv.db didn’t help. Turns out that I had already created a network with that IP range, so docker network rm <my-network> solved it for me.

I am too running into this problem on docker 1.11.1 with docker-compose 1.7.1.

Deleting /var/lib/docker/network/files/local-kv.db leaves my docker instance in an unusable state, because already created containers now give errors and newly created containers don’t have a proper networks setting.

So long and thanks for all the fish… -.-

Remove all ipv6 nameservers from /etc/resolv.conf!

clockzhong notifications@github.com ezt írta (időpont: 2017. márc. 3., P 5:43):

All the solution tried, still face this error: Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/docker/docker/issues/18113#issuecomment-283864029, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPoSvKCeIncEpGKSLQbrTx58I62YOoOks5rh5pigaJpZM4GmJnl .

I was experiencing this issue, but @DominicBoettger’s tip to set --bip did the trick for me. I noticed the problem with a VPN connection before docker started, so docker/libnetwork#779 is my real problem.

I had this issue on Centos 7 host. I figured out that firewalld and docker don’t play well nicely together. If docker is started after firewalld, we get this error. Solution was to restart docker after firewalld. and then run docker here is a sample output case 1: Docker already running, then firewalld staretd

[ali@docker-host ~]# docker run -d -p 80:80  nginx
24363b48c4acc63ea8cf43b82ee0827e5ac020606a1da478210383de6badf05b
docker: Error response from daemon: failed to create endpoint admiring_carson on network bridge: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 80 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0' failed: iptables: No chain/target/match by that name..

case 2. docker running, firewalld started , docker restarted

[ali@docker-host ~]# systemctl restart docker
[ali@docker-host ~]# docker run -d -p 80:80  nginx
3d64557729d78d503ecaf2baa70e0a7a7136153f82236d449d7f8386552bb563
[ali@docker-host ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                         NAMES
3d64557729d7        nginx               "nginx -g 'daemon off"   13 seconds ago      Up 10 seconds       0.0.0.0:80->80/tcp, 443/tcp   modest_dubinsky
[ali@docker-host ~]#