Docker: Could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

user8194539 picture user8194539 · Mar 8, 2018 · Viewed 7.8k times · Source

When I was trying to deploy my application with docker-compose I got back the following error:

Creating network "<myapplicationnamehere_mycustomnetwork>" with the 
default driver
could not find an available, non-overlapping IPv4 address pool among 
the defaults to assign to the network

Now I researched a bit here and there and people suggested to prune unused old docker networks with docker network prune. But since I am running 34 docker containers (about ~30 networks I think), it only prunes one or two old networks before the error occurs again.

My question is: How can I make sure I can run many services without running into docker network allocation problems. (Maybe create smaller subnets somehow?)

My top-key network section of the docker-compose file looks as follows:

#
# Networks section
# Networks:
# - public, represents the network between nginx and the public nginx-proxy (which should be already running)
# - uwsgi, represents the network between nginx and uwsgi
# - postgres, represents the network between uwsgi and postgres
#
networks:
  uwsgi:
  postgres:
  public:
    external:
      name: nginx-proxy

Answer

user8194539 picture user8194539 · Sep 14, 2018

You can know specify custom address ranges with the default-address-pool property since Docker 18.06. See also the associated Pull Request.