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

前端 未结 19 585
别那么骄傲
别那么骄傲 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:25

    I ran into the same problem

    Creating network "schemaregistry1_default" with the default driver
    ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

    and nothing helped until I turned off the Cisco VPN. after that docker-compose up worked

    0 讨论(0)
  • 2020-12-12 11:26

    I ran into this problem because I had OpenVPN running. As soon as I killed OpenVPN, docker-compose up fired right up, and the error disappeared.

    0 讨论(0)
  • 2020-12-12 11:26

    I ran into this issue on a corporate development VM which wasn't running OpenVPN. Checking out etc/docker/daemon.json, I found

    ...
    "default-address-pools": [
      {
        "base": "192.168.11.0/24",
        "size": 24
      }
    ],
    ...
    

    Strangely, removing the default-address-pools field and then restarting docker with sudo systemctl restart docker fixed the issue for me. I'm assuming this let docker choose a more suitable default, but I don't know what the problem was with the chosen default.

    0 讨论(0)
  • 2020-12-12 11:28

    I've seen it suggested docker may be at its maximum of created networks. The command docker network prune can be used to remove all networks not used by at least one container.

    My issue ended up being, as Robert commented about: an issue with openvpn service openvpn stop 'solved' the problem.

    0 讨论(0)
  • 2020-12-12 11:28

    I had an identical problem with the same error message but the solution with removal of unused docker networks didn't help me. I've deleted all non-default docker networks (and all images and containers as well) but it didn't help - docker still was not able to create a new network.

    The cause of the problem was in network interfaces that were left after OpenVpn installation. (It was installed on the host previously.) I found them by running ifconfig command:

    ...
    tun0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.8.0.2  P-t-P:10.8.0.2  Mask:255.255.255.0
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:75 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:84304 (84.3 KB)  TX bytes:0 (0.0 B)
    
    tun1  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.8.0.2  P-t-P:10.8.0.2  Mask:255.255.255.0
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:200496 errors:0 dropped:0 overruns:0 frame:0
          TX packets:148828 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:211583838 (211.5 MB)  TX bytes:9568906 (9.5 MB)
    ...
    

    I've found that I can remove them with a couple of commands:

    ip link delete tun0
    ip link delete tun1
    

    After this the problem has disappeared.

    0 讨论(0)
  • 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 <name> 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.

    0 讨论(0)
提交回复
热议问题