【解决】could not find an available, non-overlapping IPv4 address pool among the defaults to assign t...

在同一套环境中跑了不少个项目都是用 docker-compose的方式启动的,致使建立的自定义网络过多出现下面的报错docker

Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

查看自定义网络网络

[root@lyj ~]# docker network ls |wc -l
31

这是由于 Docker 默认支持 30 个不一样的自定义 bridge 网络,若是超过这个限制,就会提示上面的错误。你能够使用命令docker network ls来查看你建立的网络,而后经过命令docker network prune来移除没有使用的网络。app

 

我采用另外一种方式,将全部的项目加入到同一个自定义网络当中以节省自定义网络的数量ui

每台机器上执行:spa

docker network create xxx-network

docker-compose 文件中写入以下内容code

version: '3'

services:
app:
  build: ./app
  networks:
     - xxx-network
networks:
xxx-network:
  external: true

参考:Docker-compose引入外部网络get

相关文章
相关标签/搜索