docker3网络 容器与外网连接

ip_forward

iptables

----------------------------------------------------------------------------------------------------------------------------------------------

容器要想访问外部网络,需要本地系统的转发支持

  

cat /etc/sysctl.conf
net.ipv4.ip_forward = 1

如果再启动Docker服务的时候设定 --ip-forward=true,Docker就会自动设置系统的ip_forward值为1

---------------------------------------------------------------------------------------------------------------------------------

容器允许外部访问,可以在docker run 的时候指定-p 或参数-P来启用

iptables -t filter -nL  
(filter表)
iptables -t nat -nL

(nat表)

猜你喜欢

转载自blog.csdn.net/ssllkkyyaa/article/details/81773212