centos 8上docker0以外的容器没有传出网络流量

centos 8上docker0以外的容器没有传出网络流量,docker,networking,docker-networking,Docker,Networking,Docker Networking,我找到了关于这个问题的帖子。然而,我所做的只是使我的安装崩溃 我的问题的根源是:无法从容器中访问正在主机上侦听127.0.0.1:3306的mysql 环境:Centos8,docker ce/docker版本20.10.5,构建55c4c88 我以前尝试过ping/traceroute到google-ifconfig: docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.

我找到了关于这个问题的帖子。然而,我所做的只是使我的安装崩溃

我的问题的根源是:无法从容器中访问正在主机上侦听127.0.0.1:3306的mysql

环境:Centos8,docker ce/docker版本20.10.5,构建55c4c88

我以前尝试过ping/traceroute到google-ifconfig:

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:7dff:fe3a:1d23  prefixlen 64  scopeid 0x20<link>
        ether 02:42:7d:3a:1d:23  txqueuelen 0  (Ethernet)
        RX packets 152  bytes 9114 (8.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2132 (2.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Lokale Schleife)
        RX packets 8  bytes 400 (400.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 400 (400.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 127.0.0.1  netmask 255.255.255.255  broadcast 0.0.0.0  destination 127.0.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)
        RX packets 20275  bytes 48492440 (46.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7901  bytes 1118291 (1.0 MiB)
        TX errors 0  dropped 125 overruns 0  carrier 0  collisions 0

venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 85.214.171.64  netmask 255.255.255.255  broadcast 85.214.171.64  destination 85.214.171.64
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)

veth182b7de: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::b463:b4ff:fecd:8989  prefixlen 64  scopeid 0x20<link>
        ether b6:63:b4:cd:89:89  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth2bbb74a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2415:b4ff:fe28:e625  prefixlen 64  scopeid 0x20<link>
        ether 26:15:b4:28:e6:25  txqueuelen 0  (Ethernet)
        RX packets 99  bytes 7654 (7.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 1076 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
(限制为2跳,与默认的30跳没有区别)

ifconfig输出:

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:7dff:fe3a:1d23  prefixlen 64  scopeid 0x20<link>
        ether 02:42:7d:3a:1d:23  txqueuelen 0  (Ethernet)
        RX packets 166  bytes 9860 (9.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37  bytes 2480 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Lokale Schleife)
        RX packets 8  bytes 400 (400.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 400 (400.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 127.0.0.1  netmask 255.255.255.255  broadcast 0.0.0.0  destination 127.0.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)
        RX packets 20326  bytes 48495436 (46.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7936  bytes 1124283 (1.0 MiB)
        TX errors 0  dropped 134 overruns 0  carrier 0  collisions 0

venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 85.214.171.64  netmask 255.255.255.255  broadcast 85.214.171.64  destination 85.214.171.64
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)

veth182b7de: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::b463:b4ff:fecd:8989  prefixlen 64  scopeid 0x20<link>
        ether b6:63:b4:cd:89:89  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 908 (908.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth2bbb74a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2415:b4ff:fe28:e625  prefixlen 64  scopeid 0x20<link>
        ether 26:15:b4:28:e6:25  txqueuelen 0  (Ethernet)
        RX packets 99  bytes 7654 (7.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 1118 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
docker0:flags=4163 mtu 1500
inet 172.17.0.1网络掩码255.255.0.0广播172.17.255.255
inet6 fe80::42:7dff:fe3a:1d23预桥64作用域ID 0x20
乙醚02:42:7d:3a:1d:23 txqueuelen 0(以太网)
接收数据包166字节9860(9.6千字节)
接收错误0丢弃0超出0帧0
发送数据包37字节2480(2.4千字节)
发送错误0丢弃0溢出0载波0冲突0
低:标志=73 mtu 65536
inet 127.0.0.1网络掩码255.0.0.0
inet6::1前缀轴128作用域ID 0x10
回路txqueuelen 1000(Lokale Schleife)
接收数据包8字节400(400.0 B)
接收错误0丢弃0超出0帧0
发送数据包8字节400(400.0 B)
发送错误0丢弃0溢出0载波0冲突0
venet0:标志=211 mtu 1500
inet 127.0.0.1网络掩码255.255.255.255广播0.0.0.0目标127.0.0.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0(unspec)
接收数据包20326字节48495436(46.2 MiB)
接收错误0丢弃0超出0帧0
发送数据包7936字节1124283(1.0 MiB)
发送错误0丢弃134超出0载波0冲突0
venet0:0:flags=211 mtu 1500
inet 85.214.171.64网络掩码255.255.255.255广播85.214.171.64目标85.214.171.64
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0(unspec)
veth182b7de:标志=4163 mtu 1500
inet6 fe80::b463:b4ff:fecd:8989预驱动桥64作用域ID 0x20
乙醚b6:63:b4:cd:89:89 txqueuelen 0(以太网)
接收数据包0字节0(0.0B)
接收错误0丢弃0超出0帧0
发送数据包14字节908(908.0 B)
发送错误0丢弃0溢出0载波0冲突0
veth2bbb74a:标志=4163 mtu 1500
inet6 fe80::2415:b4ff:fe28:e625预桥64作用域ID 0x20
以太26:15:b4:28:e6:25 txqueuelen 0(以太网)
接收数据包99字节7654(7.4千字节)
接收错误0丢弃0超出0帧0
发送数据包19字节1118(1.0千字节)
发送错误0丢弃0溢出0载波0冲突0
显然,数据包在venet0上被丢弃了

我需要配置什么才能连接到容器外部(包括127.0.0.1)

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:7dff:fe3a:1d23  prefixlen 64  scopeid 0x20<link>
        ether 02:42:7d:3a:1d:23  txqueuelen 0  (Ethernet)
        RX packets 166  bytes 9860 (9.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37  bytes 2480 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Lokale Schleife)
        RX packets 8  bytes 400 (400.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 400 (400.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 127.0.0.1  netmask 255.255.255.255  broadcast 0.0.0.0  destination 127.0.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)
        RX packets 20326  bytes 48495436 (46.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7936  bytes 1124283 (1.0 MiB)
        TX errors 0  dropped 134 overruns 0  carrier 0  collisions 0

venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>  mtu 1500
        inet 85.214.171.64  netmask 255.255.255.255  broadcast 85.214.171.64  destination 85.214.171.64
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 0  (UNSPEC)

veth182b7de: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::b463:b4ff:fecd:8989  prefixlen 64  scopeid 0x20<link>
        ether b6:63:b4:cd:89:89  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 908 (908.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth2bbb74a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2415:b4ff:fe28:e625  prefixlen 64  scopeid 0x20<link>
        ether 26:15:b4:28:e6:25  txqueuelen 0  (Ethernet)
        RX packets 99  bytes 7654 (7.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 1118 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0