当我尝试使用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
您可以知道自Docker 18.06以来使用default-address-pool属性指定自定义地址范围。另见the associated Pull Request。