Solve the problem that centos8 docker cannot access the public network

Install bridge-utils

centos8There is no source bridge-utils, may bridge-utilsno longer maintained, I find the latest version of the current time of 2016year 1.6version, so the bridge-utilsneed to compile and install the source code Download
compile and install steps

tar -xf bridge-utils-1.6.tar.xz
cd bridge-utils-1.6
yum install autoconf
./configure --prefix=/usr
make
make install

Firewall allows IP address forwarding

Refer to the Centos8 installation Docker container cannot access the network

systemctl start firewalld #启动防火墙服务
firewall-cmd --add-masquerade --permanent     ##永久开启IP地址转发
firewall-cmd --reload         ##重载防火墙规则,使之生效

Rebuild the bridge

systemctl stop docker
iptables -t nat -F POSTROUTING
ip link set dev docker0 down
brctl delbr docker0
systemctl start docker

Guess you like

Origin blog.csdn.net/macaiyun0629/article/details/106874167