New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find a free IP address range for interface 'docker0' #362

Closed
srid opened this Issue Apr 9, 2013 · 15 comments

Comments

Projects
None yet
@srid
Copy link
Contributor

srid commented Apr 9, 2013

this used to work until the default bridge changed to docker0:

$ sudo bin/docker -d
2013/04/08 18:37:27 Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'

netstat -nr reads:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 ppp0
10.0.3.0        0.0.0.0         255.255.255.0   U         0 0          0 lxcbr0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.69.21   0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
204.244.102.2   192.168.1.254   255.255.255.255 UGH       0 0          0 eth0
204.244.102.2   192.168.1.254   255.255.255.255 UGH       0 0          0 eth0

i'm on VPN if that matters.

the only way to workaround this problem is to use the already-existing lxbr0 bridge:

sudo bin/docker -d -b lxcbr0
@niclashoyer

This comment has been minimized.

Copy link

niclashoyer commented Apr 26, 2013

same problem here, running Ubuntu 12.10

@carlsverre

This comment has been minimized.

Copy link

carlsverre commented May 1, 2013

Same issue here

root@memcompute2:/home/memsql/carl# cat /etc/issue
Ubuntu 11.04 \n \l

root@memcompute2:/home/memsql/carl# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.8.0.2        0.0.0.0         255.255.255.255 UH        0 0          0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
10.8.0.0        10.8.0.2        255.255.255.0   UG        0 0          0 tun0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
@thouveng

This comment has been minimized.

Copy link

thouveng commented May 7, 2013

Same problem for me. The interesting thing is that it only happens when a VPN connection is active.
I'm running on Debian Wheezy on my version of docker is:

(master)~/git/docker$ docker version
2013/05/07 21:16:58 docker version
Version: 0.3.0
Git Commit: 7b1ec9f
Kernel: 3.2.0-4-amd64
WARNING: No memory limit support
WARNING: No swap limit support

The main difference I see is that when I'm using the VPN a tun0 interface is created. The new route created by the VPN creates a problem. I can see:

[debug] network.go:129 172.16.42.1/24: Unexpected ip route output: invalid CIDR address: A.B.C.D (A.B.C.D via 192.168.0.254 dev eth0  src 192.168.0.17 )

where A.B.C.D is the vpn

And this error is the same with 10.0.42.1/24 and 192.168.42.1/24

NOTE: If I start docker before the VPN it works.

Hope this help
Guillaume

@dbanck

This comment has been minimized.

Copy link

dbanck commented May 14, 2013

I'm having the same problem with Ubuntu 12.04, docker 0.3.2-1 (from ppa) and no special network settings.

ansible@raven:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         133.9.52.2      0.0.0.0         UG    100    0        0 eth0
10.0.3.0        0.0.0.0         255.255.255.0   U     0      0        0 lxcbr0
133.9.52.2      0.0.0.0         255.255.255.255 UH    0      0        0 eth0
ansible@raven:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 52:54:00:b3:4e:a6  
          inet addr:133.9.226.97  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: 2a01:4f8:150:7242:3::2/80 Scope:Global
          inet6 addr: fe80::5054:ff:feb3:4ea6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40832 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21507 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:159258823 (159.2 MB)  TX bytes:4816877 (4.8 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:10671 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10671 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:816106 (816.1 KB)  TX bytes:816106 (816.1 KB)

lxcbr0    Link encap:Ethernet  HWaddr ce:42:f3:21:d4:ed  
          inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::cc42:f3ff:fe21:d4ed/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:468 (468.0 B)

The docker debug output looks like this:

ansible@raven:~$ sudo docker -d -D
[debug] network.go:100 Routes:

default via 133.9.52.2 dev eth0  metric 100 
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1 
133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 

[debug] network.go:129 172.16.42.1/24: Unexpected ip route output: invalid CIDR address: 133.9.52.2 (133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 )
[debug] network.go:100 Routes:

default via 133.9.52.2 dev eth0  metric 100 
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1 
133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 

[debug] network.go:129 10.0.42.1/24: Unexpected ip route output: invalid CIDR address: 133.9.52.2 (133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 )
[debug] network.go:100 Routes:

default via 133.9.52.2 dev eth0  metric 100 
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1 
133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 

[debug] network.go:129 192.168.42.1/24: Unexpected ip route output: invalid CIDR address: 133.9.52.2 (133.9.52.2 dev eth0  proto kernel  scope link  src 133.9.226.97 )
2013/05/14 18:33:59 Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0

133.9.52.2 isn't a valid CIDR address since it's missing the prefix, but the route outputs are without a prefix. So why do you check for a CIDR address?

@jbeda

This comment has been minimized.

Copy link
Contributor

jbeda commented May 24, 2013

Actually, there are 2 issues here.

The original issue is that, with your VPN, you are sitting on 3 different networks that use all 3 of the RFC1918 IP spaces. You can only go so deep here. There is a FIXME in the code to look wider for a /24 that will work.

I hit the second issue. What is happening is that you are on a /32 subnet and the 'ip routes' command leaves off the '/32'. This code should also check if this can be parsed as an IP. If so, assume that it is a /32 subnet. The code in question is here: https://github.com/jbeda/docker/blob/master/network.go#L96.

@creack

This comment has been minimized.

Copy link
Contributor

creack commented Jun 17, 2013

This can be fixed using the -b option of docker daemon. You need to manually create a bridge for docker and then start the daemon with docker -d -b mybridge0

@sjbalaji

This comment has been minimized.

Copy link

sjbalaji commented Jun 24, 2013

I faced the same issue and used this tutorial below to create a bridge
www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks

@creack creack closed this Jul 24, 2013

@steeve

This comment has been minimized.

Copy link
Contributor

steeve commented Jul 31, 2013

Could you reopen the issue?

I'm getting this error because of this line in my "ip route" command:

default via 192.168.0.254 dev eth0
127.0.0.1 dev lo  scope link
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.120

Even though the CIDR isn't valid, it should ignore it I think!
Or maybe append /8 to it ?

And maybe add /32 to static ip addresses ?

steeve added a commit to steeve/docker that referenced this issue Aug 1, 2013

Handle ip route showing mask-less IP addresses
Sometimes `ip route` will show mask-less IPs, so net.ParseCIDR will fail. If it does we check if we can net.ParseIP, and fail only if we can't.
Fixes moby#1214
Fixes moby#362
@metakermit

This comment has been minimized.

Copy link
Contributor

metakermit commented Aug 5, 2013

Got the same message while trying to set up docker while connected to a PPPoWLAN network. To expand on the fix proposed by @creack I created a bridge like this in Ubuntu (following the help wiki):

sudo brctl addbr docker0 # create your bridge
sudo brctl addif docker0 eth0 # mask an existing interface using the bridge
sudo ip link set dev docker0 up # bring it up - not really sure if this is necessary or is it done automatically
sudo ifconfig docker0 10.0.0.4 # give it an IP

You should now be able to start docker.

 sudo docker -d -b docker0

crosbymichael added a commit that referenced this issue Aug 13, 2013

Handle ip route showing mask-less IP addresses
Sometimes `ip route` will show mask-less IPs, so net.ParseCIDR will fail. If it does we check if we can net.ParseIP, and fail only if we can't.
Fixes #1214
Fixes #362
@doomdagger

This comment has been minimized.

Copy link

doomdagger commented Jul 7, 2014

@kermit666 I follow your commands listed below and then my server's DNS service stops working... Is there anything wrong?

@metakermit

This comment has been minimized.

Copy link
Contributor

metakermit commented Jul 7, 2014

@doomdagger hm... I don't know. If you tried the usual method of just rebooting and it doesn't help, you can try reversing the steps by deleting the bridge (brctl delbr docker0) and then rebooting. If it doesn't help, you should probably try some of the official help channels (http://askubuntu.com/ or http://serverfault.com/) or just googling around a bit.

@chameleon95

This comment has been minimized.

Copy link

chameleon95 commented May 7, 2015

FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

I also face this problem, only when using the Astrill VPN client..

FATA[0000] Shutting down daemon due to errors: Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'

When Astrill VPN client is disabled, without problem..

"Daemon has completed initialization"

@isuftin

This comment has been minimized.

Copy link

isuftin commented May 17, 2015

👍 Same issue here happening when OpenVPN client is running on same machine. Unable to run Docker and OpenVPN client at the same time.

@hechen0

This comment has been minimized.

Copy link

hechen0 commented May 22, 2015

upstart log here

Waiting for /var/run/docker.sock
INFO[0000] +job serveapi(unix:///var/run/docker.sock)
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
INFO[0000] +job init_networkdriver()
Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'
INFO[0000] -job init_networkdriver() = ERR (1)
FATA[0000] Shutting down daemon due to errors: Could not find a free IP address range for interface 'docker0'. Please configure its address manually and run 'docker -b docker0'

kernel version here

➜  upstart  uname -r
3.13.0-32-generic

error here

FATA[0000] Get http:///var/run/docker.sock/v1.18/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

os version here

VERSION="14.04.2 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.2 LTS"
VERSION_ID="14.04"
@goraxe

This comment has been minimized.

Copy link

goraxe commented May 30, 2015

had the same issue, turns out our dhcp was giving out static routes for 10.0.0.0/8, 192.168.0.0/24, 172.16.0.0/16. If you are having issues run the docker dameon in the terminal with -d -D and grok the debug output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment