Docker Can Create Only 31 Networks per Machine

I have just learned that in Docker there is a limit of 31 networks for default network driver on a single machine:

docker-black

This is due to the fact that it uses hardcoded list of broad network ranges – 172.17-31.x.x/16 and 192.168.x.x/20 – for bridge network driver. Look into ipamutils and allocator for more details. For overlay network driver 64K networks can be created.

There seems to be no solution to circumvent this limitation apart from manually specifying subnet ranges for each created network – see Docker network create subnet option and Docker Compose network configuration reference. In Puffin, which needs to create a separate network for each application, I implemented a simple address allocator.

2 thoughts on “Docker Can Create Only 31 Networks per Machine

  1. You can create more than 31 networks by controlling the subnet to be used by the docker network.

    Try this:

    for net in {1..50}; do docker network create -d bridge –subnet=172.18.${net}.0/24 net${net} ; done

  2. Yes, that’s what I mention in the last paragraph:

    > There seems to be no solution to circumvent this limitation apart from manually specifying subnet ranges for each created network – see Docker network create subnet option …

Leave a Reply

Your email address will not be published.