Answers: <p>Do you need to run it beside a VPN "OpenVPN service" ? </p>
  
  <p>I think using below would solve the issue for clearing any unused networks by at least 1 container.</p>
  
  <pre><code>$ docker network prune
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-08-09T18:48:00.810Z
Answers: As stated, I have no non-builtin docker networks created, so there is nothing to prune. There is no vpn service running.
Answers: Marcin
Answers: CC BY-SA 4.0
Answers: 2018-08-12T11:16:56.847Z
Answers: So you may try to see the created networks and remove any unneeded networks, you may post the result for the below command.  
  
       #    docker network ls
Answers: lORD
Answers: CC BY-SA 4.0
Answers: 2018-08-12T18:53:14.930Z
Answers: Right, there are only the three builtin networks.
Answers: Marcin
Answers: CC BY-SA 4.0
Answers: 2018-08-13T13:14:02.287Z
Answers: So could you try to run prune command and retest once again ?
Answers: lORD
Answers: CC BY-SA 4.0
Answers: 2018-08-13T15:53:13.250Z
Answers: Let me be clear: I have no non-built in networks to prune. You think the problem is that there a bunch of existing networks. There are not.
Answers: Marcin
Answers: CC BY-SA 4.0
Answers: 2018-08-09T07:32:02.987Z
Answers: 2018-08-09T07:32:02.987Z
Answers: lORD
Answers: <p>You can explore <a href="https://github.com/docker/libnetwork/blob/922cd533eac14b6e0754756c5cacf9f44af5d699/network.go#L1657" rel="nofollow noreferrer">the sources</a> to investigate concrete case. Also I explained in <a href="https://stackoverflow.com/a/60157448/3338479">this stackoverflow answer</a> why it probably happened.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-10T20:27:32.627Z
Answers: 2020-02-10T20:27:32.627Z
Answers: lucidyan
Body: <h1>The problem</h1>
  
  <p>The problem is that this happens:</p>
  
  <pre><code>$ docker network create  alpine4
  Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
  </code></pre>
  
  <p>Notwithstanding that I have <em>no</em> non-builtin docker networks created.</p>
  
  <p>The logs suggest that these network ranges are being attempted:</p>
  
  <pre><code>DEBU[2018-08-08T17:21:00.877120275Z] ReleasePool(LocalDefault/192.168.240.0/20)   
  DEBU[2018-08-08T17:21:00.877135316Z] ReleasePool(LocalDefault/192.168.224.0/20)   
  DEBU[2018-08-08T17:21:00.877162150Z] ReleasePool(LocalDefault/192.168.208.0/20)   
  DEBU[2018-08-08T17:21:00.877170059Z] ReleasePool(LocalDefault/192.168.192.0/20)   
  DEBU[2018-08-08T17:21:00.877176154Z] ReleasePool(LocalDefault/192.168.176.0/20)   
  DEBU[2018-08-08T17:21:00.877198642Z] ReleasePool(LocalDefault/192.168.160.0/20)   
  DEBU[2018-08-08T17:21:00.877204723Z] ReleasePool(LocalDefault/192.168.144.0/20)   
  DEBU[2018-08-08T17:21:00.877212452Z] ReleasePool(LocalDefault/192.168.128.0/20)   
  DEBU[2018-08-08T17:21:00.877220350Z] ReleasePool(LocalDefault/192.168.112.0/20)   
  DEBU[2018-08-08T17:21:00.877232829Z] ReleasePool(LocalDefault/192.168.96.0/20)    
  DEBU[2018-08-08T17:21:00.877243072Z] ReleasePool(LocalDefault/192.168.80.0/20)    
  DEBU[2018-08-08T17:21:00.877253643Z] ReleasePool(LocalDefault/192.168.64.0/20)    
  DEBU[2018-08-08T17:21:00.877264171Z] ReleasePool(LocalDefault/192.168.48.0/20)    
  DEBU[2018-08-08T17:21:00.877274553Z] ReleasePool(LocalDefault/192.168.32.0/20)    
  DEBU[2018-08-08T17:21:00.877284675Z] ReleasePool(LocalDefault/192.168.16.0/20)    
  DEBU[2018-08-08T17:21:00.877296023Z] ReleasePool(LocalDefault/192.168.0.0/20)     
  DEBU[2018-08-08T17:21:00.877307062Z] ReleasePool(LocalDefault/172.31.0.0/16)      
  DEBU[2018-08-08T17:21:00.877322208Z] ReleasePool(LocalDefault/172.30.0.0/16)      
  DEBU[2018-08-08T17:21:00.877333550Z] ReleasePool(LocalDefault/172.29.0.0/16)      
  DEBU[2018-08-08T17:21:00.877339489Z] ReleasePool(LocalDefault/172.28.0.0/16)      
  DEBU[2018-08-08T17:21:00.877350224Z] ReleasePool(LocalDefault/172.27.0.0/16)      
  DEBU[2018-08-08T17:21:00.877361031Z] ReleasePool(LocalDefault/172.26.0.0/16)      
  DEBU[2018-08-08T17:21:00.877367371Z] ReleasePool(LocalDefault/172.25.0.0/16)      
  DEBU[2018-08-08T17:21:00.877374978Z] ReleasePool(LocalDefault/172.24.0.0/16)      
  DEBU[2018-08-08T17:21:00.877382471Z] ReleasePool(LocalDefault/172.23.0.0/16)      
  DEBU[2018-08-08T17:21:00.877395020Z] ReleasePool(LocalDefault/172.22.0.0/16)      
  DEBU[2018-08-08T17:21:00.877405540Z] ReleasePool(LocalDefault/172.21.0.0/16)      
  DEBU[2018-08-08T17:21:00.877415851Z] ReleasePool(LocalDefault/172.20.0.0/16)      
  DEBU[2018-08-08T17:21:00.877426869Z] ReleasePool(LocalDefault/172.19.0.0/16)      
  DEBU[2018-08-08T17:21:00.877437210Z] ReleasePool(LocalDefault/172.18.0.0/16)    
  </code></pre>
  
  <p>Even stranger, if I pick any of those subnet ranges to use as an explicit subnet range, creation works <em>just fine</em>:</p>
  
  <pre><code>$ docker network create --subnet 172.31.0.0/16 alpine3
  189ec86443c0799a298f672497aa24fb17dc725d810cd6c3917555ae6c185012
  </code></pre>
  
  <h1>The question</h1>
  
  <p>Given the above, why can't I just create a bridge network and have docker pick a subnet range for me?</p>
  
  <h1>Setup</h1>
  
  <pre><code>$ dockerd --version
  Docker version 18.03.1-ce, build 9ee9f40
  </code></pre>
  
  <p>Running on ubuntu 16.04 in aws. Installed using the official .deb, no special configs in place (indeed, no <code>daemon.json</code> at all)</p>
  
Tags: <docker><linux><networking>
Title: Docker won't create a bridge network without being given an explicit subnet
UserDisplayName: Marcin
ThreadText: # Docker won't create a bridge network without being given an explicit subnet
  
  (Asked by: username_0 on 2018-08-08)
  
  # The problem
  
  The problem is that this happens:
  
  ```
  $ docker network create  alpine4
  Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
  
  ```
  
  Notwithstanding that I have *no* non-builtin docker networks created.
  
  The logs suggest that these network ranges are being attempted:
  
  ```
  DEBU[2018-08-08T17:21:00.877120275Z] ReleasePool(LocalDefault/192.168.240.0/20)   
  DEBU[2018-08-08T17:21:00.877135316Z] ReleasePool(LocalDefault/192.168.224.0/20)   
  DEBU[2018-08-08T17:21:00.877162150Z] ReleasePool(LocalDefault/192.168.208.0/20)   
  DEBU[2018-08-08T17:21:00.877170059Z] ReleasePool(LocalDefault/192.168.192.0/20)   
  DEBU[2018-08-08T17:21:00.877176154Z] ReleasePool(LocalDefault/192.168.176.0/20)   
  DEBU[2018-08-08T17:21:00.877198642Z] ReleasePool(LocalDefault/192.168.160.0/20)   
  DEBU[2018-08-08T17:21:00.877204723Z] ReleasePool(LocalDefault/192.168.144.0/20)   
  DEBU[2018-08-08T17:21:00.877212452Z] ReleasePool(LocalDefault/192.168.128.0/20)   
  DEBU[2018-08-08T17:21:00.877220350Z] ReleasePool(LocalDefault/192.168.112.0/20)   
  DEBU[2018-08-08T17:21:00.877232829Z] ReleasePool(LocalDefault/192.168.96.0/20)    
  DEBU[2018-08-08T17:21:00.877243072Z] ReleasePool(LocalDefault/192.168.80.0/20)    
  DEBU[2018-08-08T17:21:00.877253643Z] ReleasePool(LocalDefault/192.168.64.0/20)    
  DEBU[2018-08-08T17:21:00.877264171Z] ReleasePool(LocalDefault/192.168.48.0/20)    
  DEBU[2018-08-08T17:21:00.877274553Z] ReleasePool(LocalDefault/192.168.32.0/20)    
  DEBU[2018-08-08T17:21:00.877284675Z] ReleasePool(LocalDefault/192.168.16.0/20)    
  DEBU[2018-08-08T17:21:00.877296023Z] ReleasePool(LocalDefault/192.168.0.0/20)     
  DEBU[2018-08-08T17:21:00.877307062Z] ReleasePool(LocalDefault/172.31.0.0/16)      
  DEBU[2018-08-08T17:21:00.877322208Z] ReleasePool(LocalDefault/172.30.0.0/16)      
  DEBU[2018-08-08T17:21:00.877333550Z] ReleasePool(LocalDefault/172.29.0.0/16)      
  DEBU[2018-08-08T17:21:00.877339489Z] ReleasePool(LocalDefault/172.28.0.0/16)      
  DEBU[2018-08-08T17:21:00.877350224Z] ReleasePool(LocalDefault/172.27.0.0/16)      
  DEBU[2018-08-08T17:21:00.877361031Z] ReleasePool(LocalDefault/172.26.0.0/16)      
  DEBU[2018-08-08T17:21:00.877367371Z] ReleasePool(LocalDefault/172.25.0.0/16)      
  DEBU[2018-08-08T17:21:00.877374978Z] ReleasePool(LocalDefault/172.24.0.0/16)      
  DEBU[2018-08-08T17:21:00.877382471Z] ReleasePool(LocalDefault/172.23.0.0/16)      
  DEBU[2018-08-08T17:21:00.877395020Z] ReleasePool(LocalDefault/172.22.0.0/16)      
  DEBU[2018-08-08T17:21:00.877405540Z] ReleasePool(LocalDefault/172.21.0.0/16)      
  DEBU[2018-08-08T17:21:00.877415851Z] ReleasePool(LocalDefault/172.20.0.0/16)      
  DEBU[2018-08-08T17:21:00.877426869Z] ReleasePool(LocalDefault/172.19.0.0/16)      
  DEBU[2018-08-08T17:21:00.877437210Z] ReleasePool(LocalDefault/172.18.0.0/16)    
  
  ```
  
  Even stranger, if I pick any of those subnet ranges to use as an explicit subnet range, creation works *just fine*:
  
  ```
  $ docker network create --subnet 172.31.0.0/16 alpine3
  189ec86443c0799a298f672497aa24fb17dc725d810cd6c3917555ae6c185012
  
  ```
  
  # The question
  
  Given the above, why can't I just create a bridge network and have docker pick a subnet range for me?
  
  # Setup
  
  ```
  $ dockerd --version
  Docker version 18.03.1-ce, build 9ee9f40
  
  ```
  
  Running on ubuntu 16.04 in aws. Installed using the official .deb, no special configs in place (indeed, no `daemon.json` at all)
  
  **Tags:** docker, linux, networking
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-08-09. Score: 2
  
  Do you need to run it beside a VPN "OpenVPN service" ?
  
  I think using below would solve the issue for clearing any unused networks by at least 1 container.
  
  ```
  $ docker network prune
  
  ```
  
  > **Comments:**
  > **username_0**: As stated, I have no non-builtin docker networks created, so there is nothing to prune. There is no vpn service running.  
  > **username_1**: So you may try to see the created networks and remove any unneeded networks, you may post the result for the below command.         #    docker network ls  
  > **username_0**: Right, there are only the three builtin networks.  
  > **username_1**: So could you try to run prune command and retest once again ?  
  > **username_0**: Let me be clear: I have no non-built in networks to prune. You think the problem is that there a bunch of existing networks. There are not.  
  
  ---
  
  ### Answer by username_2 on 2020-02-10. Score: 0
  
  You can explore [the sources](https://github.com/docker/libnetwork/blob/922cd533eac14b6e0754756c5cacf9f44af5d699/network.go#L1657) to investigate concrete case. Also I explained in [this stackoverflow answer](https://stackoverflow.com/a/60157448/3338479) why it probably happened.
  
  
  ---
  
  