-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
While triaging #36510 (comment), I noticed that the current error message is rather cryptic, and doesn't provide enough information for the user to resolve the problem:
Error initializing network controller: list bridge addresses failed: no available network
When the daemon starts, it attempts to find if any of the standard private IP-ranges is available for docker to use (doesn't overlap with existing networks in your situation): 172.17-31.x.x/16, 192.168.x.x/20 or 10.x.x.x/24:
moby/vendor/github.com/docker/libnetwork/ipamutils/utils.go
Lines 10 to 15 in 747c163
| // PredefinedBroadNetworks contains a list of 31 IPv4 private networks with host size 16 and 12 | |
| // (172.17-31.x.x/16, 192.168.x.x/20) which do not overlap with the networks in `PredefinedGranularNetworks` | |
| PredefinedBroadNetworks []*net.IPNet | |
| // PredefinedGranularNetworks contains a list of 64K IPv4 private networks with host size 8 | |
| // (10.x.x.x/24) which do not overlap with the networks in `PredefinedBroadNetworks` | |
| PredefinedGranularNetworks []*net.IPNet |
When failing to select a range, only the error above is printed.
I sugest we improve the error, and (if possible) call out:
- each IP-range that is tried
- a message explaining that Docker failed to automatically select an available IP-range
- possibly referring to the documentation: https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/ (note: in the latest rewrite of the docs, I think some of that information has gone lost /cc @gbarr01)
- should we mention the "VPN" situation? (i.e. a VPN capturing all IP-ranges, causing detection to fail?)
Note that the detection is done in libnetwork; generally "libraries" should not do logging, so that's possibly something to take into account when implementing.
ping @fcrisciani @selansen PTAL if you have input on this; I'm assigning this exp/beginner and exp/intermediate - possibly a contributor wants to work on this