configure docker network size

Docker uses by default /16 network for every network you create with it. This means you have 65534 available IPs in this network. Especially if you use docker-compose, you will create a network for every project / docker-compose file you run.

If you create to many networks, docker will use ip addresses from or from The chance this interference with your given network is then high. So you should think about the needed network size and adjust the default settings.

Because I mostly did not run many containers, but many projects and so many networks, I use a /27 network for every network. This means I have 30 available IPs. Because I typically have not more than 10 containers in one network, this is enough. You can also choose another network size depending on your needs:

Network SizeIPsavailable IPs

Now change your docker default config in /etc/docker/daemon.json. You have to create the file, if it didn’t exists. And add the setting default-address-pools:

            "scope": "local",

You can choose as base everything you want, but please use only IPs reserved for private networks.