Hyperledger fabric Docker container error Error response from daemon Container is not running

–1 vote

I am running the bash file like this: 

docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb

I am getting this error:

Error response from daemon: Container 9338fh518d4158f29f0800c8bbef1c2b3749ffnsjqde34190fh2375e415b44it9f is not running

When i run this command

docker rm -f $(docker ps -aq)

and rerun bash file everytime I get the same error but the container is different.

Here is bash file:

# 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

starttime=$(date +%s)

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

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

# 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"

Please help

Nov 2, 2018 in Blockchain by digger
• 26,740 points

6 answers to this question.

+1 vote
Best answer

I had to update the version of fabric samples to solve this error. Nothing else worked. To get the new version, you can use the following command:

$ git clone https://github.com/hyperledger/fabric-samples.git
answered Apr 25, 2019 by Gani

selected Apr 25, 2019 by Omkar
0 votes

Use this command to run bash file:

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

Don't use -d

answered Nov 2, 2018 by Omkar
• 69,230 points
0 votes
Hello, did someone solve the problem ?
answered Apr 9, 2019 by Nicolas P Duchemann

Yes, this solve my problem:

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

Maybe your docker container is not staying awake for more time. For me, I had to keep the docker container at least for 15 seconds. After a lot of research I found this command that actually worked for me:

$ ls -la /; sleep 10m

answered Apr 25, 2019 by Rahul
0 votes

Remove the containers that are not being used and then try to run the fabric.

To stop and delete the containers, use the following command:

$ docker stop$(docker ps -aq)
$ docker rm $(docker ps -aq)

This will remove all the containers, so do not use it if you have any important containers running.

answered Apr 25, 2019 by Sunny
Hi @Sunny. I have some containers that are not being used and some containers that I require and so cannot remove them. How can I remove only the unused containers?

Hey, @sunny, there is no direct command for this. You will have to do it manually. First, find the containers that are running.

$ docker ps -aq

Then see which containers are not being used and note their container ID. Next, to stop and remove the containers, run the following command:

$ docker stop <docker id>
$ docker rm <docker id>
0 votes

Open the startFabric.sh file and find the line:

docker-compose -f "${DOCKER_FILE}" down

Comment this line, save the file and try running your command again. It worked for me. 

answered Apr 26, 2019 by Rasheed

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer

Hyperledger Fabric:Promise is rejected:Error:Failed to deserialize creator identity,The supplied identity is not valid.

 This error happens because basic-network/docker-compose.yaml has CA ...READ MORE

answered Nov 14, 2018 in Blockchain by Omkar
• 69,230 points
+2 votes
1 answer
0 votes
1 answer
0 votes
3 answers
0 votes
1 answer
0 votes
3 answers

Hyperledger fabcar sample fabric error: sendPeersProposal - Promise is rejected: Error: Connect Failed

Open the datasources.json file and replace the grpcs:// with grpc://. This solution worked ...READ MORE

answered Apr 30, 2019 in Blockchain by Reshma
+2 votes
3 answers

Hyperledger Fabric: Peer Connection error: Failed obtaining connection: Could not connect to any of the endpoints.

 You can extend your /etc/hosts file and make orderer.example.com domain name ...READ MORE

answered Nov 13, 2018 in Blockchain by Omkar
• 69,230 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP