1
votes

I have succesfully started first-network, it consists of 4 peers, 2 for each org. Using docker exec cli I can only send commands to peer0.org1.example.com. The question is how can I send calls for example to peer0.or2.example.com? In docs it's said:

For the following CLI commands against peer0.org1.example.com to work, we need to preface our commands with the four environment variables given below. These variables for peer0.org1.example.com are baked into the CLI container, therefore we can operate without passing them. HOWEVER, if you want to send calls to other peers or the orderer, then you will need to provide these values accordingly. Inspect the docker-compose-base.yaml for the specific paths:

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp

CORE_PEER_ADDRESS=peer0.org1.example.com:7051

CORE_PEER_LOCALMSPID="Org1MSP"

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

So when I change these variables for example for CORE_PEER_LOCALMSPID="Org2MSP" and so on - nothing changes because when I do docker exec it cli bash and then in docker as peer echo $CORE_PEER_LOCALMSPID it still says Org1Msp

2

2 Answers

2
votes

From your explanation it sounds like you are setting your environmental variables before going into the cli container. This will not work as when you go into the cli container it will reset the environmental variables back to the ones you have set in your compose file, which I assume you have bootstrapped to peer0 of org1.

You need to go into the cli container first and set the variables there in that environment. After that if you echo you will see the change. Again if you then exit and enter it again all the variables will be reset to the bootstrapped ones.

Another option would be to change the variables in the compose file or have another cli container that's bootstrapped to a different peer/org.

1
votes

Alternatively, you can have cli respective to each peer (too much in compose yaml file though) and launch the same for running any command.