使用Docker Toolbox的Hyperledger Fabric v0.6 [英] Hyperledger Fabric v0.6 using Docker Toolbox
问题描述
我在Windows上使用Docker Toolbox运行Hyperledger Fabric v0.6.对等方和CA已成功启动. 当我运行以下命令时:
I am using Docker Toolbox on Windows to run Hyperledger Fabric v0.6. Peer and CA has started successfully. When I run the following command :
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02.
最后出现错误:
"尝试连接到本地对等端时出错:grpc:超时 拨号"
"Error trying to connect to local peer : grpc : timed out when dialing"
我将0.0.0.0:7051
更改为dockerfile_vp0_1的内部IP,172.17.0.3 :7051
,但最终还是遇到相同的错误.
I changed 0.0.0.0:7051
to the internal IP of the dockerfile_vp0_1, 172.17.0.3 :7051
but I end up with the same error.
我正在按照 https://github.com/hyperledger/fabric/blob/v0.6.1-preview/docs/Setup/Chaincode-setup.md ,而且我在公司防火墙后面.
I am following the instructions from https://github.com/hyperledger/fabric/blob/v0.6.1-preview/docs/Setup/Chaincode-setup.md and also I am behind a corporate firewall.
可以请你帮忙.
我知道CORE_PEER_ADDRESS是对等方的IP地址,那么CORE_VM_ENDPOINT是什么?
I understand that CORE_PEER_ADDRESS is the IP address of the peer, then what is CORE_VM_ENDPOINT?
推荐答案
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
命令的运行位置似乎是关键因素.
The location where the CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
command is run appears to be the key factor.
我可以复制通过运行docker-compose up,在Windows主机上获取chaincode_example02代码,在Windows上构建chaincode,然后打开新的Docker Quickstart窗口所经历的相同结果.我将目录更改为$ GOPATH/src/github.com/chaincode_example02目录,然后运行上述命令.结果与问题中指出的结果相符.
I can replicate the same results that were experienced by running docker-compose up, obtaining the chaincode_example02 code on the Windows host, building the chaincode on Windows, and then opening a new Docker Quickstart window. I changed directory to the $GOPATH/src/github.com/chaincode_example02 directory and then ran the above command. The results match the results noted in the question.
从Docker容器中为对等映像运行命令应产生不同的结果.
Running the command from within the Docker container for the peer image should produce different results.
- 基于docker-compose.yml文件运行
docker-compose up
后,打开另一个Docker Quickstart窗口. - 使用类似于以下命令的命令导航到对等方的文件系统:
docker exec -it <substitute container name>_vp0_1 bash
.要找到容器名称,您可以先运行docker ps
. - 在对等文件系统中,您可以通过查看/opt/gopath/src/github.com/hyperledger/fabric/peer/core.yaml文件来检查正在使用的端口.对等方的"listenAddress"标记为0.0.0.0:7051.
-
netstat -an
命令可用于检查端口7051是否处于侦听状态. - 如果对等方似乎未在端口7051上侦听,请确保已运行
peer node start --peer-chaincodedev
命令.这应该是docker-compose.yml文件的结果,因为它是该文件中的最后一条语句. - 导航到对等文件系统中的/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02并运行
go build
. - 留在同一chaincode_example02目录中,并运行
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS:0.0.0.0.7051 ./chaincode_example02
命令
- After running
docker-compose up
based on the docker-compose.yml file, open another Docker Quickstart window. - Navigate into the file system for the peer by using a command similar to this command:
docker exec -it <substitute container name>_vp0_1 bash
. To find the container name, you can first rundocker ps
. - Once in the peer file system, you can check the ports that are being used by reviewing the /opt/gopath/src/github.com/hyperledger/fabric/peer/core.yaml file. The "listenAddress" for the peer is noted as 0.0.0.0:7051.
- The
netstat -an
command can be used to check that port 7051 is in listening state. - If the peer doesn't seem to be listening on port 7051, make sure that the
peer node start --peer-chaincodedev
command has run. This should have happened as a result of the docker-compose.yml file since it is the last statement in that file. - Navigate to /opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 within the peer file system and run
go build
. - Stay in the same chaincode_example02 directory and run the
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS:0.0.0.0.7051 ./chaincode_example02
command
这篇关于使用Docker Toolbox的Hyperledger Fabric v0.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!