问题:
我对使用Hyperledger的区块链非常陌生。我正在自定义startNetwork.sh脚本。所以我创建了这样的东西。
String
但是当我在bash终端上点击./startNetwork.sh时,我会得到
的错误。# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
#removing all the containers
echo "#### Removing all the containers"
echo ""
echo ""
docker rm -f $(docker ps -aq)
echo ""
echo ""
#prune the volumes
echo "#### Prune the network "
echo ""
echo ""
docker volume prune
echo ""
echo ""
#down the previously build networks
echo "##### Removing networks and containers #####"
echo ""
echo ""
docker-compose -f docker-compose-cli.yaml down --volumes
echo ""
echo ""
#Up the network
echo ""
echo "##### Network is under the build #####"
echo ""
echo ""
docker-compose -f docker-compose-cli.yaml up -d
echo ""
echo ""
#starting the cli
echo ""
echo ""
echo "##### Starting the cli incase if it is sleep #####"
docker start cli
echo ""
echo ""
docker exec -e "CORE_PEER_LOCALMSPID=PSPMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/users/Admin@psp.example.com/msp" -e "CORE_PEER_ADDRESS=peer0.psp.example.com:7051" -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/peers/peer0.psp.example.com/tls/ca.crt" peer0.psp.example.com peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
但是当我在cli容器中发出此命令时,它已成功运行。有人可以帮助我修改此文件以摆脱此错误吗?谢谢!
答案 0 :(得分:0)
cli希望一些加密工件可以与Fabric组件交互。在示例中,它们被生成,并被安装到特定路径下的docker容器中,并导出为env var ,因此可以在容器中调用它。您需要在bash中进行相同的设置才能使其正常工作。看看 cli容器是如何在docker compose文件中定义的(可能不胜枚举,也许在cli容器中做一个更好的主意)