Created
          June 24, 2020 11:11 
        
      - 
      
- 
        Save vikiival/ae2781d6ba3d5959a44c90d5dda5bf76 to your computer and use it in GitHub Desktop. 
    Add cli to Hyperledger test network
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | cli: | |
| container_name: cli | |
| image: hyperledger/fabric-tools:$IMAGE_TAG | |
| tty: true | |
| stdin_open: true | |
| environment: | |
| - GOPATH=/opt/gopath | |
| - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock | |
| - FABRIC_LOGGING_SPEC=INFO | |
| #- FABRIC_LOGGING_SPEC=DEBUG | |
| - CORE_PEER_ID=cli | |
| - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 | |
| - CORE_PEER_LOCALMSPID=Org1MSP | |
| - CORE_PEER_TLS_ENABLED=true | |
| - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt | |
| - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key | |
| - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | |
| - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp | |
| working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer | |
| command: /bin/bash | |
| volumes: | |
| - /var/run/:/host/var/run/ | |
| - ../chaincode/:/opt/gopath/src/github.com/chaincode | |
| - ../organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations | |
| - ../scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ | |
| depends_on: | |
| - peer0.org1.example.com | |
| networks: | |
| - test | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
To open bash in CLI node:
docker exec -it cli bashQuery:
peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryCar", "CAR123"]}'Invoke:
peer chaincode invoke -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n fabcar --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["createCar", "CAR123", "xxx", "xxx", "xxx" , "Viki"]}'