修改docker默认的网段,与阿里云内网网段冲突

修改docker默认的网段,因为与阿里云内网网段冲突

1、编辑/etc/docker/daemon.json(若不存在新建即可)

{
    "bip": "178.90.0.1/24"
}
{
    "default-address-pools" : [
       {
            "base" : "18.0.0.0/16",
            "size" : 24
       }
    ]
}

2、查询docker占用网段,并删除,

docker network ls

结果里面有一些是默认

NETWORK ID     NAME                   DRIVER    SCOPE
2ce7728ad567   appsmith_default       bridge    local
04f06f2b5b35   bridge                 bridge    local
32c8ad4d94c9   cashadminpet_default   bridge    local
5886fec0cf1d   host                   host      local
e30f12ebc019   none                   null      local
155dad08d3cc   plausible_default      bridge    local
ef977cfa2d6b   umami_default          bridge    local
96e46ad7c29a   wikijs_default         bridge    local

查询docker占用网段,

route -n

结果

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.21.63.253   0.0.0.0         UG    100    0        0 eth0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-155dad08d3cc
172.19.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-ef977cfa2d6b
172.20.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-2ce7728ad567
172.21.0.0      0.0.0.0         255.255.192.0   U     100    0        0 eth0
172.22.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-96e46ad7c29a
172.23.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-32c8ad4d94c9
192.166.0.0     0.0.0.0         255.255.255.0   U     0      0        0 docker0

删除网段,一个个的删除。

docker network rm 2ce7728ad567

3.重启服务

systemctl daemon-reload
systemctl restart docker 
posted @ 2022-09-04 18:33  总统先生  阅读(409)  评论(0编辑  收藏  举报