Hyperledger Fabric v0.6 using Docker Toolbox

669 views Asked by At

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.

End up with the error :

"Error trying to connect to local peer : grpc : timed out when dialing"

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.

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.

Can you please help.

I understand that CORE_PEER_ADDRESS is the IP address of the peer, then what is CORE_VM_ENDPOINT?

1

There are 1 answers

2
Andrew Tharp On BEST ANSWER

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.

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.

Running the command from within the Docker container for the peer image should produce different results.

  1. After running docker-compose up based on the docker-compose.yml file, open another Docker Quickstart window.
  2. 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 run docker ps.
  3. 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.
  4. The netstat -an command can be used to check that port 7051 is in listening state.
  5. 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.
  6. Navigate to /opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 within the peer file system and run go build.
  7. 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