有两个具有以下配置的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
同时启动的应用程序都通过TCP / IP进行通信。
这是网络配置:
[
{
"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": {}
}
]
当我在Wireshark中分析网络通信时,我可以看到多个乱序的TCP数据包。
您有什么建议为什么会发生以及如何解决?这可能是解决我在here中描述的其他问题的可能解决方案。
答案 0 :(得分:0)
您可以查看数据包的MAC地址吗?如果仔细观察,数据包77和数据包78具有相似的有效负载。有一种可能,容器正在使用网桥的MAC地址发送数据包,而网桥正在路由数据包。
容器内部的 ip route
可以通过路由或桥接确认数据包之间的通信是否发生。