如何通过管理器访问集群网络中其他系统的Docker容器?

时间:2019-11-22 06:01:44

标签: docker docker-swarm docker-swarm-mode

我的集群网络中有五个系统。一个系统是网络的管理器,其余的是工作节点。 这是来自docker network inspect docker-config_default的docker网络信息:

[
    {
        "Name": "docker-config_default",
        "Id": "mdlobn3vywz46l68p5agupvpd",
        "Created": "2019-11-19T10:18:31.233567329+05:30",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "3b171993e0566e96b93387cc1ae1dade97728c003ebe663b7fdac9e2bf7fb437": {
                "Name": "orderer3.example.in",
                "EndpointID": "7e651d00f6f2a708323d7a7564f594549d9ff5ebec3581855cf1f30c8ebb91e7",
                "MacAddress": "02:42:0a:00:00:0c",
                "IPv4Address": "10.0.0.12/24",
                "IPv6Address": ""
            },
            "3c126175d913334a8491627abca4790ee1dc5616dfc6ba400e342cce5d45493f": {
                "Name": "hello",
                "EndpointID": "a94ddecc63b11b9313f86cc00e95b2adb49fe43d01f8942df3efdc5083d5c531",
                "MacAddress": "02:42:0a:00:00:02",
                "IPv4Address": "10.0.0.2/24",
                "IPv6Address": ""
            },
            "3f71a7789e0bacfed05982157c55747bc023cdff58680283abe30b031967beee": {
                "Name": "orderer4.example.in",
                "EndpointID": "8b0faae5e6f29cd646982d374e605e5e13bf5e8f0c110b979245f9977e1d9922",
                "MacAddress": "02:42:0a:00:00:0d",
                "IPv4Address": "10.0.0.13/24",
                "IPv6Address": ""
            },
            "7dd8834816d901573e46e992f6aa9a1f76cc39b6695972fa03fc5dc70780f934": {
                "Name": "orderer5.example.in",
                "EndpointID": "fb9bc016238f3ea3538e9756cf3f904acd73e3d78453f21058f61ab1053765c0",
                "MacAddress": "02:42:0a:00:00:0e",
                "IPv4Address": "10.0.0.14/24",
                "IPv6Address": ""
            },
            "b53481087c0928c01b27e95d3c22c40347cbf6758062c1a42ae0542d0ada8307": {
                "Name": "orderer2.example.in",
                "EndpointID": "02472217eabd1eeaaa8212d07de19cc335619292096c78fba52eb88cd028135d",
                "MacAddress": "02:42:0a:00:00:0b",
                "IPv4Address": "10.0.0.11/24",
                "IPv6Address": ""
            },
            "db01e6deac97ebf21e861a1e6058944b6dc82ea2a37a295b941340914c7e118b": {
                "Name": "orderer.example.in",
                "EndpointID": "4c491fcb36d912c801e89c47eaf8a5ab1d6c1e76c0d59406b124fe48a9c2698d",
                "MacAddress": "02:42:0a:00:00:0a",
                "IPv4Address": "10.0.0.10/24",
                "IPv6Address": ""
            },
            "lb-docker-config_default": {
                "Name": "docker-config_default-endpoint",
                "EndpointID": "cb7abc2c6bf92a47b4e7a5a96401e86926037990740373d8a8008ea8ae289059",
                "MacAddress": "02:42:0a:00:00:03",
                "IPv4Address": "10.0.0.3/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": {},
        "Peers": [
            {
                "Name": "87bfb110be53",
                "IP": "10.244.1.139"
            },
            {
                "Name": "3718c24185ce",
                "IP": "10.244.1.156"
            },
            {
                "Name": "ca46b2caf0e2",
                "IP": "10.244.1.40"
            },
            {
                "Name": "a3477ffef2fb",
                "IP": "10.244.0.94"
            },
            {
                "Name": "238d19204670",
                "IP": "10.244.1.149"
            }
        ]
    }
]

类似地,在其他系统中,我每个也运行3个容器。 现在,从我的docker集群的master / manager节点中,我想在worker节点的容器内执行命令。我试图直接这样做 docker exec -it peer0.example1.in bash,但出现错误:
Error: No such container: peer0.example1.in

有什么想法如何从集群网络中的管理者节点进入工作节点的容器?

0 个答案:

没有答案