Skip to main content

docker网段冲突

info

错误信息: ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

解决方案

修改docker网卡默认网段

docker网卡默认网段一般为172.17.0.1/16

cd /etc/docker
vi daemon.json

添加网段配置 {"bip": "172.20.0.1/16"}

systemctl daemon-reload
systemctl restart docker

指定容器网桥

修改docker-compose.yml文件及docker-compose-operation.yml文件中的网桥配置 如:

web:
container_name: web
image: nginx:1.21.6-alpine
logging:
driver: json-file
options:
max-size: 100m
max-file: "1"
networks:
- backend
ports:
- 3030:80
restart: always
ulimits:
nproc: 4096
nofile:
soft: 1024
hard: 3072
volumes:
- /etc/localtime:/etc/localtime:ro
- /opt/dev/airiot/web/html:/usr/share/nginx/html
- /opt/dev/airiot/web/portal:/usr/share/nginx/portal
- /opt/dev/airiot/web/nginx.conf:/etc/nginx/nginx.conf

networks:
backend:
ipam:
config:
- subnet: "10.11.0.0/24"
version: '3'

services:
operation:
container_name: operation
image: airiot/operation:latest
restart: always
environment:
- PROJECTNAME=dev
- "CORS.ENABLE=true"
- INTERNETACCESS=false
networks:
- backend
ports:
- "13031:10088"
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/dev/:/app/compose/
- /opt/dev/airiot/web/html:/app/html
- /opt/dev/operation/data:/data
- /opt/dev/operation/log:/log
- /opt/dev/operation/configs:/app/configs
- /opt/dev/operation/build:/app/web
- /opt/dev/operation/driverRepo:/driverRepo
ulimits:
nproc: 4096
nofile:
soft: 1024
hard: 3072
logging:
driver: "json-file"
options:
max-size: 100m
max-file: "1"

networks:
backend:
ipam:
config:
- subnet: 10.10.0.0/24

启动平台

./runOperation.sh
./run.sh