Skip to content

Improve error if no auto-selecting IP-range failed #36512

@thaJeztah

Description

@thaJeztah

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:

// 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:

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions