用于连接网络容器的IP地址是什么?

时间:2018-05-25 15:16:49

标签: docker hyperledger-fabric hyperledger hyperledger-composer

[
    {
        "Name": "composer_default",
        "Id": "1b06e8bd3c547c739285284f89d416b6bae6cad8d8a5437659cc2877136c5e8f",
        "Created": "2018-05-25T06:42:35.269643488Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1963ad6763c63f3e4dd15b0a4717ddee5c2fe39dad90edbd75c4a0c4f412439b": {
                "Name": "orderer.example.com",
                "EndpointID": "a34529bb554dd0a7f3ad706cf95536112774b209619364dd98f7edbb5317b150",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "46237b2a21b2a2dbb513ccea7e93793538bcdeaf583e82911c2451f7ee109faf": {
                "Name": "couchdb",
                "EndpointID": "398a01a0f85cf91ddb23933ded579597263135cbe5b027a73d9bbe374837a06f",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "5baee4bb30d087b0d622954228be91509124f632a81774fb382fe0e80111d32b": {
                "Name": "ca.org1.example.com",
                "EndpointID": "a458f59f8d3fa2600f6eb933ee685bffc08ac83cd793ad707f9188b1a07fb6a9",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            },
            "651d6d2878104cc496b0bafd6466b70d8a45ef462cc06130e93e0a50214d1f99": {
                "Name": "peer0.org1.example.com",
                "EndpointID": "9e9a7c2c3164d6258e5bd3231376772703fe2d621978e0760e44569fc3c8c567",
                "MacAddress": "02:42:ac:12:00:05",
                "IPv4Address": "172.18.0.5/16",
                "IPv6Address": ""
            },
            "da6a8ade513c4fb9b1a351f42e0a06f2e26f0eb471fa08832aa3863285e2f384": {
                "Name": "dev-peer0.org1.example.com-usps-imts-network-0.0.2",
                "EndpointID": "0f73549d1c16abb13fe1a2d1a1a175e6161ad3d155064033654a436669468b9e",
                "MacAddress": "02:42:ac:12:00:06",
                "IPv4Address": "172.18.0.6/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

我在容器中有另一个Node.js应用程序,我将添加到此composer_default网络。 orderer.example.com也在此网络中的自己的容器中。当Node.js应用程序位于容器之外时,我之前正在进行grpc://localhost:7050连接。

现在它在一个容器中,grpc://<WHAT-IP-SHOULD-I-USE>:7050

我尝试了容器名称grpc://orderer.example.com:7050以及网络网关grpc://172.18.0.1:7050,但无法连接。

1 个答案:

答案 0 :(得分:1)

容器名称或IP应该有效http:localhost:7050 =&gt; http://orderer.example.com:7050http://172.18.0.3:7050

{  
   "name":"hlfv1",
   "x-type":"hlfv1",
   "x-commitTimeout":300,
   "version":"1.0.0",
   "client":{  
      "organization":"Org1",
      "connection":{  
         "timeout":{  
            "peer":{  
               "endorser":"300",
               "eventHub":"300",
               "eventReg":"300"
            },
            "orderer":"300"
         }
      }
   },
   "channels":{  
      "composerchannel":{  
         "orderers":[  
            "orderer.example.com"
         ],
         "peers":{  
            "peer0.org1.example.com":{  

            }
         }
      }
   },
   "organizations":{  
      "Org1":{  
         "mspid":"Org1MSP",
         "peers":[  
            "peer0.org1.example.com"
         ],
         "certificateAuthorities":[  
            "ca.org1.example.com"
         ]
      }
   },
   "orderers":{  
      "orderer.example.com":{  
         "url":"grpc://orderer.example.com:7050"
      }
   },
   "peers":{  
      "peer0.org1.example.com":{  
         "url":"grpc://peer0.org1.example.com:7051",
         "eventUrl":"grpc://peer0.org1.example.com:7053"
      }
   },
   "certificateAuthorities":{  
      "ca.org1.example.com":{  
         "url":"http://ca.org1.example.com:7054",
         "caName":"ca.org1.example.com"
      }
   }
}