简体   繁体   English

Hyperledger Fabric-Docker容器错误

[英]hyperledger fabric - docker container error

The docker container stops upon completion of the script. Docker容器在脚本完成后停止。

Running bash file ( docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb ) 运行bash文件(docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb)

Get error: 得到错误:

Error response from daemon: Container 987d99518d4158f29f0800c8bbef1c2b1295d6fade341fde7c775e415b700a38 is not running

Running: 正在运行:

docker ps -a

Says status is exited(1) 13 seconds 说状态已退出(1)13秒

So it ran and shut down? 因此它运行并关闭了?

Also each time I run: 同样,每次我运行时:

docker rm -f $(docker ps -aq)

and rerun bash file its a different container that is in the error message. 并重新运行bash文件及其错误消息中的其他容器。

Here is bash file: 这是bash文件:

#!/bin/bash
#
# SPDX-License-Identifier: Apache-2.0
# This code is based on code written by the Hyperledger Fabric community. 
# Original code can be found here: https://github.com/hyperledger/fabric-samples/blob/release/fabcar/startFabric.sh
#
# Exit on first error

set -e

# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1

starttime=$(date +%s)

if [ ! -d ~/.hfc-key-store/ ]; then
mkdir ~/.hfc-key-store/
fi

# launch network; create channel and join peer to channel
cd ../basic-network
./start.sh

# Now launch the CLI container in order to install, instantiate chaincode
# and prime the ledger with our 10 tuna catches
docker-compose -f ./docker-compose.yml up -d cli

docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode install -n tuna-app -v 1.0 -p github.com/tuna-app
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n tuna-app -v 1.0 -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
sleep 10
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n tuna-app -c '{"function":"initLedger","Args":[""]}'

printf "\nTotal execution time : $(($(date +%s) - starttime)) secs ...\n\n"
printf "\nStart with the registerAdmin.js, then registerUser.js, then server.js\n\n"

remove that -d flag. 删除该-d标志。

docker-compose -f ./docker-compose.yml up cli

only cli will exit as you don't need it to run in foreground but rest of your containers will always run in the foreground. 只有cli会退出,因为您不需要它在前台运行,但是其余容器将始终在前台运行。

In case you wanna check deeper, in your docker-compose file, remove -d from command attribute. 如果您想更深入地检查,请在docker-compose文件中,从命令属性中删除-d。

Let me know if it works for you. 请让我知道这对你有没有用。 and put here your docker ps -a in case it doesn't work for you. 然后将您的docker ps -a放在这里,以防它对您不起作用。

Solution 1 - 解决方案1-

When you start your network with the following command, CLI container will stick around by default for 1000 seconds. 当您使用以下命令启动网络时,默认情况下,CLI容器会停留1000秒。

docker-compose -f docker-compose-cli.yaml up -d

so before running this command you will have to set the TIMEOUT variable. 因此在运行此命令之前,您必须设置TIMEOUT变量。 To Set the timeout execute the following command before starting your network. 要设置超时,请在启动网络之前执行以下命令。

export TIMEOUT=<no of seconds your CLI should stay up>

this way you can ensure your cli stays up as long as you need to execute further commands. 这样,只要您需要执行其他命令,就可以确保cli保持正常运行。

Also if your CLI is not running then simply execute this command to start the CLI. 另外,如果您的CLI未运行,则只需执行此命令即可启动CLI。

docker start cli

Solution -2 解决方案-2

Before running docker-compose -f docker-compose-cli.yaml up -d command open the docker-compose-cli.yaml` file. 在运行docker-compose -f docker-compose-cli.yaml up -d命令之前,打开docker-compose-cli.yaml`文件。

then comment out the following line like this - 然后像这样注释掉以下行-

#command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME} ${DELAY}; sleep $TIMEOUT'

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Hyperledger Fabric设置下载特定平台二进制文件权限错误OSX - Hyperledger Fabric set-up download specific platform binaries permissions error OSX Fabric Hyperledger 部署链码失败 - javascript - Fabric Hyperledger Deploying Chaincode failed - javascript 错误:在docker容器中导入Postgres数据库 - Error: Postgres database import in docker container 使用docker运行容器时出错 - Error while running a container using docker Docker错误:容器ID后跟“找不到命令” - Docker Error: container id followed by “command not found” 如何在 Hyperledger Fabric 中检索当前链码版本? - How do I retrieve current chaincode version in Hyperledger Fabric? 使用 hyperledger fabric 调用链代码:在 $PATH\": unknown" 中找不到可执行文件 - Invoking chaincode with hyperledger fabric: Executable file not found in $PATH\ ": unknown" 超级账本结构使用 bash 设置 ORDERER_CA - hyperledger fabric set ORDERER_CA using the bash /bin/bash 给了我 docker 容器内的错误 - /bin/bash gives me the error inside docker container 简单历史记录中的错误 bash 脚本在具有“kathara 图像”的 Docker 容器中执行 - Error in a simple history bash script execution in a Docker container with a “kathara Image”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM