无法通过自定义./startNetwork.sh脚本来创建频道?

问题描述 投票:0回答:1

问题:

我对Hyperledger的区块链很新。我正在自定义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/[email protected]/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

但是当我在bash终端上点击./startNetwork.sh时,它会给我一个错误

2019-03-18 06:42:52.162 UTC [main] InitCmd -> ERRO 001 Cannot run peer because cannot init crypto, folder "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/users/[email protected]/msp" does not exist

但是,当我在cli容器内发出此命令时,它已成功运行。有人可以帮我修改这个文件,以摆脱这个错误吗?谢谢!

hyperledger-fabric
1个回答
0
投票

cli期望一些加密工件与Fabric组件交互。在示例中,它们被生成,并安装到docker包含在特定路径中,并作为env var导出,因此可以在容器中调用它。您需要在bash中执行相同的设置才能使其正常工作。查看如何在docker compose文件中定义cli容器(这可能是压倒性的,并且在cli容器中执行它可能更好)

© www.soinside.com 2019 - 2024. All rights reserved.