当前情况
1. 查看当前网桥
2. 运行容器、查看容器IP
docker run -d --restart=always --name mynginx -p 80:80 nginx
docker inspect mynginx | grep IPAddress
修改新网桥
1. 停止docker
systemctl stop docker #或 systemctl stop docker.socket
2. 停止删除原网桥 docker0
#停止
ip link set dev docker0 down
#删除(可不删)
brctl delbr docker0
3. 创建新网桥 br0
#安装工具 brctl
apt install bridge-utils
#添加
brctl addbr br0
#绑定IP
ip addr add 172.18.0.1/16 dev br0
#启动
ip link set dev br0 up
#查看
ip addr show br0
4. 新网桥绑定
修改 /etc/docker/daemon.json ;新增 "bridge":"br0"
5. 重新加载配置、启动 docker
#重新加载
systemctl daemon-reload
#启动docker
systemctl start docker
6. 查看当前容器IP
docker inspect mynginx | grep IPAddress
标签:docker0,ip,br0,systemctl,网桥,Ubuntu,docker
From: https://www.cnblogs.com/coolyang/p/17446126.html