Docker “ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network”

前端 未结 19 683
别那么骄傲
别那么骄傲 2020-12-12 10:48

I have a directory apkmirror-scraper-compose with the following structure:

.
├── docker-compose.yml
├── privoxy
│   ├── config
│   └── Dockerfil         


        
19条回答
  •  心在旅途
    2020-12-12 11:28

    If you want lots of networks then you can control how much IP space docker hands out to each network via the default-address-pools deamon setting, so you could add this to your /etc/docker/daemon.json:

    {
      "bip": "10.254.1.1/24",
      "default-address-pools":[{"base":"10.254.0.0/16","size":28}],
    }
    

    Here I've reserved 10.254.1.1/24 (254 IP addresses) for the bridge network.

    For any other network I create, docker will partition up the 10.254.0.0 space (65k hosts), giving out 16 hosts at a time ("size":28 refers to the CIDR mask, for 16 hosts).

    If I create a few networks and then run docker network inspect on them, it might display something like this:

            ...
            "Subnet": "10.254.0.32/28",
            "Gateway": "10.254.0.33"
            ...
    

    The 10.254.0.32/28 means this network can use 16 ip addresses from 10.254.0.32 - 10.254.0.47.

提交回复
热议问题