Moby: Docker 容器无法访问,TCP 校验和错误

创建于 2015-10-08  ·  3评论  ·  资料来源: moby/moby

你好,

我们无法直接或映射到容器中的端口。

信息

Docker version 1.5.0, build a8a31ef
Debian 7 backported kernel 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1~bpo70+1 (2015-04-27) x86_64 GNU/Linux
Containers: 14
Images: 29
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 57
Execution Driver: native-0.2
Kernel Version: 3.16.0-0.bpo.4-amd64
Operating System: Debian GNU/Linux 7 (wheezy)
CPUs: 4
Total Memory: 7.815 GiB
Name: xxxxx
ID: PRMV:P7KM:5U6J:PYGZ:I3LQ:QWSB:ANFJ:VA23:URM4:JQOG:7TLM:4PTI
WARNING: No memory limit support
WARNING: No swap limit support

这是我们的附加设置:

docker0   Link encap:Ethernet  HWaddr 56:84:7a:fe:97:99  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26765 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2173785 (2.0 MiB)  TX bytes:63950837 (60.9 MiB)
 vethc356415 Link encap:Ethernet  HWaddr 9e:e7:da:08:87:c6  
          inet6 addr: fe80::9ce7:daff:fe08:87c6/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:200 errors:0 dropped:0 overruns:0 frame:0
          TX packets:147 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12828 (12.5 KiB)  TX bytes:9398 (9.1 KiB)
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         xxxxxxxxxxxx   0.0.0.0         UG    0      0        0 eth0
xxxxxxxxxx   0.0.0.0         255.255.255.240 U     0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
 iptables -nL DOCKER
 Chain DOCKER (1 references)
 target     prot opt source               destination         
 ACCEPT     tcp  --  0.0.0.0/0            172.17.0.20          tcp dpt:22
 ACCEPT     tcp  --  0.0.0.0/0            172.17.0.20          tcp dpt:80

接口为 vethc356415 的运行容器是一个 Discourse 容器。 这些是它的主机和网络设置:

 "HostConfig": {
        "Binds": [
            "/var/discourse/shared/standalone:/shared",
            "/var/discourse/shared/standalone/log/var-log:/var/log"
        ],
        "CapAdd": null,
        "CapDrop": null,
        "ContainerIDFile": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "IpcMode": "",
        "Links": null,
        "LxcConf": [],
        "NetworkMode": "bridge",
        "PidMode": "",
        "PortBindings": {
            "22/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "2222"
                }
            ],
            "80/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "10001"
                }
            ]
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "ReadonlyRootfs": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": "always"
        },
        "SecurityOpt": null,
        "VolumesFrom": null
    },
 "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "172.17.0.20",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "fe80::42:acff:fe11:14",
        "LinkLocalIPv6PrefixLen": 64,
        "MacAddress": "02:42:ac:11:00:14",
        "PortMapping": null,
        "Ports": {
            "22/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "2222"
                }
            ],
            "80/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "10001"
                }
           ]
        }
    },

从容器内部,我们可以 ping 网站:

 ping google.com
 PING google.com (62.168.125.50) 56(84) bytes of data.
 64 bytes from 62.168.125.50: icmp_seq=1 ttl=59 time=0.486 ms
 64 bytes from 62.168.125.50: icmp_seq=2 ttl=59 time=0.520 ms

我们还可以使用 wget 获取 Discourse 的索引页面(例如,从容器内部执行 wget localhost)。

问题是当我们尝试从外部(例如从 Docker 主机)访问容器时:

$ wget 172.17.0.20 

或者

$ wget localhost:10001

不起作用并挂起。 当我们尝试嗅探 docker0 接口上的流量时,我们发现存在 TCP 校验和问题:

# tcpdump -i docker0 -vvv
tcpdump: listening on docker0, link-type EN10MB (Ethernet), capture size 65535 bytes
11:19:11.098052 IP (tos 0x0, ttl 64, id 30762, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.42.1.51633 > 172.17.0.20.http: Flags [S], cksum 0xcc74 (correct), seq 2431285397, win 29200, options [mss 1460,sackOK,TS val 3003252927 ecr 0,nop,wscale 7], length 0
11:19:11.098127 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.0.20.http > 172.17.42.1.51633: Flags [S.], cksum 0x8266 (incorrect -> 0x26fb), seq 449304527, ack 2431285398, win 28960, options [mss 1460,sackOK,TS val 3003252927 ecr 3003252927,nop,wscale 7], length 0
11:19:12.095536 IP (tos 0x0, ttl 64, id 30763, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.42.1.51633 > 172.17.0.20.http: Flags [S], cksum 0xcb7a (correct), seq 2431285397, win 29200, options [mss 1460,sackOK,TS val 3003253177 ecr 0,nop,wscale 7], length 0
11:19:12.095613 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.0.20.http > 172.17.42.1.51633: Flags [S.], cksum 0x8266 (incorrect -> 0x2601), seq 449304527, ack 2431285398, win 28960, options [mss 1460,sackOK,TS val 3003253177 ecr 3003252927,nop,wscale 7], length 0
11:19:13.303543 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.0.20.http > 172.17.42.1.51633: Flags [S.], cksum 0x8266 (incorrect -> 0x24d3), seq 449304527, ack 2431285398, win 28960, options [mss 1460,sackOK,TS val 3003253479 ecr 3003252927,nop,wscale 7], length 0
11:19:14.099543 IP (tos 0x0, ttl 64, id 30764, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.42.1.51633 > 172.17.0.20.http: Flags [S], cksum 0xc985 (correct), seq 2431285397, win 29200, options [mss 1460,sackOK,TS val 3003253678 ecr 0,nop,wscale 7], length 0
11:19:14.099625 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.0.20.http > 172.17.42.1.51633: Flags [S.], cksum 0x8266 (incorrect -> 0x240c), seq 449304527, ack 2431285398, win 28960, options [mss 1460,sackOK,TS val 3003253678 ecr 3003252927,nop,wscale 7], length 0
11:19:15.903555 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    172.17.0.20.http > 172.17.42.1.51607: Flags [S.], cksum 0x8266 (incorrect -> 0x0eeb), seq 1342518319, ack 2198677968, win 28960, options [mss 1460,sackOK,TS val 3003254129 ecr 3003244349,nop,wscale 7], length 0

似乎 docker 容器发送的数据包由于校验和错误(?)而被丢弃。 我们尝试在 vethc356415 上禁用任何类型的卸载:

ethtool -K vethc356415 gso off lro off tso off 
ethtool --offload vethc356415 tx off rx off

没有结果。 现在我们被困住了。 这是问题还是配置问题?

最有用的评论

您能否提供一些有关需要更改以解决此问题的防火墙设置的信息

所有3条评论

你好!

请阅读有关创建问题的重要信息。

如果您要报告新问题,请确保我们没有打开任何重复项。 您可以通过搜索此存储库的问题列表来确保这一点。 如果有重复,请关闭您的问题,并为现有问题添加评论。

如果您怀疑您的问题是错误,请编辑您的问题描述以包含如下所示的错误报告信息。 如果您未能在 7 天内提供此信息,我们将无法调试您的问题并将关闭它。 但是,如果您稍后提供信息,我们将重新打开它。

这是一种自动化的信息响应。

谢谢你。

有关报告问题的更多信息,请参阅https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting -other-issues


错误报告信息

使用以下命令从您的环境中提供关键信息:

docker version
docker info
uname -a

提供其他环境详细信息(AWS、VirtualBox、物理等):

列出重现问题的步骤:
1.
2.
3.

描述您收到的结果:

描述您期望的结果:

提供您认为重要的其他信息:

----------结束报告---------

ENEEDMOREINFO

升级到 docker 1.8.2 后问题依然存在。 通过更改主机防火墙设置解决了问题。

您能否提供一些有关需要更改以解决此问题的防火墙设置的信息

此页面是否有帮助?
0 / 5 - 0 等级