容器发布的端口接受TCP连接,而容器监听中没有任何内容

时间:2018-10-07 19:42:54

标签: docker docker-networking

编辑:我找到了一种解决方法,通过daemon.json禁用userland代理(docker-proxy)似乎可以解决此问题。这可能意味着这是docker-proxy中的一个错误,据我所知,在正常运行之前我正在运行的所有内容。

我正在尝试调试使用领事配置TCP运行状况检查的问题。领事等的配置无关紧要,因为我已经将其隔离到一个相当简单的场景中。所有容器都连接到bridge0(以下配置)。主机操作系统是Centos 7。

我希望看到的是容器2中的nc返回连接被拒绝,但它似乎已连接,然后在向一些随机字符发送了一条破损的管道之后。这是可以预期的吗?

容器1:

[user@192.168.1.2 ~]$ docker run --net=bridge0 -it -p 50032:8000 centos:7 bash
[root@a691f149c045 /]#

容器2:

[user@192.168.1.2 ~]$ docker run -it --net=bridge0 centos:7 bash
[root@e9c1cbaf3922 /]# nc 192.168.1.2 50032
asd
asd
Ncat: Broken pipe.

主机:

[user@192.168.1.2 ~]$ nc 192.168.1.2 50032
Ncat: Connection refused.

Docker bridge0配置

[user@host ~]$ docker network inspect bridge0
[
    {
        "Name": "bridge0",
        "Id": "b50864883bb2c9482b2d0da595abbe4b12e0de6b7fa91657119316fd75dcac83",
        "Created": "2018-08-16T21:38:11.501721012-04:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.24.0.0/16",
                    "IPRange": "172.24.0.0/24",
                    "Gateway": "172.24.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Containers": {
            "a691f149c045be06ad90c66221a9c35f2586b75e9a5e2f104c443ced311fdf03": {
                "Name": "gallant_lamport",
                "EndpointID": "e66a16eac8d7a405d3698fa37f6d6a47484b63c9cf07a714bbab6caf107741d6",
                "MacAddress": "02:42:ac:18:00:09",
                "IPv4Address": "172.24.0.9/16",
                "IPv6Address": ""
            },
        "e9c1cbaf3922774183afe613c6641e19346cac8d707bb2374d1251b02855a94f": {
                "Name": "xenodochial_bose",
                "EndpointID": "a01755d0468a2aa188f1b607ee63590bda4dc3e89e15dc78f1556b79fa1aac42",
                "MacAddress": "02:42:ac:18:00:0a",
                "IPv4Address": "172.24.0.10/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

0 个答案:

没有答案