简体   繁体   English

Docker组合和混乱的TCP数据包

[英]Docker compose and out-of-order TCP packets

There are two Docker containers with the following configuration: 有两个具有以下配置的Docker容器:

version: '2'

services:

  host:
    ports:
      - 8081:8081
    build:
      context: .
      dockerfile: Dockerfile
      args:
        PROJECT_DIR: Host
        PROJECT_NAME: Host
        WAIT_FOR_HOST: 0
    restart: on-failure

  client:
    depends_on:
      - host
    ports:
      - 8082:8082
    build:
      context: .
      dockerfile: Dockerfile
      args:
        PROJECT_DIR: Client
        PROJECT_NAME: Client
        WAIT_FOR_HOST: 1
    restart: on-failure

  tcpdump:
    image: kaazing/tcpdump
    network_mode: "host"
    volumes:
      - ./tcpdump:/tcpdump

Applications started on both of them communicate over TCP/IP. 在两个应用程序上启动的应用程序都通过TCP / IP进行通信。

Here is the network configuration: 这是网络配置:

[
    {
        "Name": "akkaremotetest_default",
        "Id": "4995d7e340e09e4babcca7dc02ddf4f68f70761746c1246d66eaf7ee40ccec89",
        "Created": "2018-07-21T07:55:39.3534215Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.19.0.0/16",
                    "Gateway": "172.19.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "6040c260c5195d2fe350bf3c89b5f9ede8a65d44da6adb48817fbef266a99e07": {
                "Name": "akkaremotetest_host_1",
                "EndpointID": "a6220a6fee071a29b83e30f9aeb9b9e7ec5008f04f593ff3fb2464477a7e54aa",
                "MacAddress": "02:42:ac:13:00:02",
                "IPv4Address": "172.19.0.2/16",
                "IPv6Address": ""
            },
            "a97078c28c7d221c2c9af948fe36b72590251be69e06d0e66eafd2c74f416037": {
                "Name": "akkaremotetest_client_1",
                "EndpointID": "39bcb8b1047ad666d9c568ee968602b3a93edb4ac2151ba9c3f3c02359ef84f2",
                "MacAddress": "02:42:ac:13:00:03",
                "IPv4Address": "172.19.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

When I analyse network communication in Wireshark, I can see multiple out-of-order TCP packets. 在Wireshark中分析网络通信时,我可以看到多个乱序的TCP数据包。

在此处输入图片说明

Do you have any suggestions why that happens and how to fix it? 您有什么建议为什么会发生以及如何解决? This could be a possible solution to my other problem described here . 这可能是解决我在此处描述的其他问题的可能方法。

Can you look at the MAC addresses of the packets? 你能看一下数据包的MAC地址吗? If you look closely packet 77 and packet 78 have similar payloads. 如果仔细观察,数据包77和数据包78具有相似的有效负载。 There is a possibility, the containers are sending out the packets with the MAC address of the bridge and the bridge is routing the packet. 有一种可能,容器正在使用网桥的MAC地址发送数据包,而网桥正在路由数据包。

ip route inside the containers can confirm if the communication between the packets is happening via routing or bridging. 容器内部的ip route可以通过路由或桥接确认数据包之间的通信是否发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM