有玩过docker的都知道启动docker默认会有个docker0网卡,如下
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:a8:e0:0f:0c txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
有时我们网卡本来用的是172.16的内网网段,docker0可能会冲突,所以需要修改docker0的地址
修改方案如下
vim /etc/docker/daemon.json { "bip":"10.55.0.1/16" }
修改后重启docker,即可看到docker0地址发生改变
实践哥(51cto Linux金牌讲师),运维开发自学视频:https://edu.51cto.com/topic/2582.html