Would it be possible to exclude some networks when doing a docker network create

I’m using docker-compose to spin up a number of multiple instance applications. I’m having a problem with the default networks used by docker network. Since I also use the 172.17.20.0/16, when docker automatically chooses this one I can’t access some machines (or vice-versa).

I know that there is a way to define specific networks in docker-compose, but I would like to stick to the auto creation of theses networks (theses docker-compose up move around quite a bit).

https://docs.docker.com/engine/reference/commandline/network_create/ doesn’t seem to have a system configuration (that I would expect docker daemon to read) to tell it to never try the 172.17.20.0/16, but that it can start at incrementing from 172.17.21.0/16.

I guess this would touch the PredefinedBroadNetworks generated in libnetwork https://github.com/docker/libnetwork/blob/master/ipamutils/utils.go#L12

1 Like

This issue is being discussed on the libnetwork’s github https://github.com/docker/libnetwork/issues/1272