Note: I published refreshed version on Medium
I have just learned that in Docker there is a limit of 31 networks for default network driver on a single machine:
$ docker network create test1
$ docker network create test31
$ docker network create test32
Error response from daemon: failed to parse pool request for address space "LocalDefault" pool "" subpool "": could not find an available predefined network
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 (Update: it’s now possible to customize the ranges in Docker daemon configuration). 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.