Docker:无法在要分配给网络的默认值中找到可用的,不重叠的IPv4地址池

时间:2018-03-08 10:45:06

标签: docker networking docker-compose docker-networking docker-network

当我尝试使用docker-compose部署我的应用程序时,我收到了以下错误:

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

现在我在这里和那里进行了一些研究,人们建议用docker network prune修剪未使用的旧码头网络。但是因为我运行了34个docker容器(我认为大约有30个网络),所以它只会在错误发生之前修剪一个或两个旧网络。

我的问题是:如何在不遇到docker网络分配问题的情况下确保运行多项服务。 (也许以某种方式创建更小的子网?)

docker-compose文件的顶级网络部分如下所示:

#
# 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

1 个答案:

答案 0 :(得分:1)

您可以知道从Docker 18.06开始使用default-address-pool属性指定自定义地址范围。另请参见the associated Pull Request