-
Notifications
You must be signed in to change notification settings - Fork 86
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
Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network #599
Comments
small update: when i run but what is wrong with my docker setup so that |
Same issue here, Running on Debian-Buster. Found out this was being caused by the expressvpn client. |
I have the same issue, the reason is if you have an IP with the range 172.16.0.0/12 on your network device. I think there is a problem in this code path: https://github.com/docker/libnetwork/blob/a79d3687931697244b8e03485bf7b2042f8ec6b6/ipam/allocator.go#L429-L444 If I take my local interface down before I start docker, it's possible to create a network. It doesn't matter which networks I added to the daemon.json config
Docker is also unable to create a bridge if eth0 has a 172.16.0.0/12 ip it only works if I create a docker0 bridge by my self. |
This also happens with nordvpn. I would tend to believe the vpn device and the routing mess up with docker's expectation of the network configuration:
In my case, I have two devices which provide internet: enp0s20f0u1 (usb thethering) and wlp4s0 (wlan). The nordvpn client decided to route encrypted traffic through enp0s20f0u1 as you can notice in the ip table. After stopping the VPN, it looks like this:
The diff between both looks like this:
With the VPN disabled (right hand side), i'm able to create the network (through docker stack deploy) |
In my case it was an issue with Error:
To fix the above errors i have created the docker network manually using below command.. |
I also have this problem ,why creating network subnet must be specified. [root@VM_68_63_centos /home/soft/pkg/envoy/examples/redis]# docker network create "test" |
In case it helps get a bit of traction on this issue, it's trivial to reproduce on centos: docker network create test1 # works
defaultGateway=$(/sbin/ip route | awk '/default/ { print $3 }')
ip route add 192.168.0.0/16 via $defaultGateway dev eth0
ip route add 172.16.0.0/12 via $defaultGateway dev eth0
docker network create test2 # fails
docker network create test1 --subnet 172.18.0.0/16 # works Note that in my setup those routes would already have been going to the default gateway, so the two routes added above should have no impact. If docker is needing to add further entries to the route table to change routing for a particular (new) subnet, then I don't see that existing entries should have any impact on that (because the two entries above are way less specific than the entries that docker would add). I'm going to guess that the reason people are seeing this when they have VPN software installed is because that also modifies the route table. So, is it the case that docker is by default incompatible with certain route table entries? As an aside, is this still the right place for this issue? Or should it be in the moby project somewhere? (I'm not sure where the split is) |
Had the same issue with openvpn, I had to kill the openvpn process and then docker was able to create the network |
What's wrong is the pre-defined bridge ranges are all in use already so Docker can't use them. Closing since this is not a bug, but feel free to discuss. |
@cpuguy83 yes, the default address pools can be changed, but to what? According to docker/docs#8663 the default pools are two out of three of the private address ranges ( So, to change the default address pools to something which you don't have an existing route table entry for will mean changing to an address range outside of the private network space - i.e. letting docker occupy public address space, which seems like a bad idea. So what do you recommend they're changed too? Note that I tried setting the default pools to be subsets of the ranges noted above, but that prevents the daemon even starting up, with the error What's particularly frustrating and confusing is that if you set the subnet specifically e.g. |
Docker will happily do the same when you specify an address pool. The error is from the automatic pool selector when it can't find an available range. The error is also specifically for the default bridge network. For the default network you can use |
@cpuguy83 Even when specifying
fails with this error:
Note that the addresses I've selected for So I'm not sure if I've misunderstood what you were suggesting or if there's a bug where (btw I'm happy to take the conversation out of this ticket and then post back once there's some consensus, if there's someone more appropriate) |
Killing the vpn is not needed. Create a network with:
Then, at the bottom of docker-compose.yaml, put this:
|
Thank you! Saved me hours of searching for the solution |
I experienced this issue while running an OpenVPN client which was also my default route. Stopping the OpenVPN client worked around the issue. |
@chadfurman 's solution worked for me (though I used 10.0.1.0/24). But the problem is that now I need to access my docker's PostgreSQL on
Can I map it to |
NordVPN also may cause this problem |
Had this happen to me when using aws client vpn and trying to use docker-compose. disconnecting from client VPN fixed the issue (ubuntu 21) |
Yes, this person has the same solution as @mattjamesaus Also there is a link to a solution for running both vpn and docker-compose within the linked stackoverflow post. |
OpenVPN is also one of the cause |
@cpuguy83
But requested network by docker is not used and free to use. I can easily add route my {
"bip": "192.168.128.1/24",
"default-address-pools":
[
{"base":"192.168.128.0/17","size":28}
]
} my compose file: version: '3.7'
services:
rabbitmq:
image: rabbitmq:latest
networks:
net:
aliases:
- 'rabbitmq.local'
networks:
net:
driver: bridge
The new route that should be assigned to new docker network is This is ugly every time to stop VPN connection to recreate docker container. |
What is “your-network” and how do I find it? Is it just 192.168.50.1? |
@mrtargaryen I just stumbled upon your question. Remark Answer Here is documentation on
Documentation from the shell, viewed by typing More info on the command can be found in the official docker documentation: CLI reference, docker network create. The names in their examples are "my-bridge-network" or "my-multihost-network". Happy learning! :) |
I have a fresh docker installation running on Ubuntu 18.04 LTE
When I try to create a new network it fails:
ifconfig says:
routes:
iptables:
Any ideas what could be wrong?
The text was updated successfully, but these errors were encountered: