Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (4.1k points)

I set up Hyperledger Fabric V0.6 with a docker image. I wrote a small chain code program and perform some operations. Data is getting stored and fetched on request from Hyperledger blockchain.

I restart my chaincode program and data still persist. Of course, this should be the expected behavior.

But when I stop my Hyperledger fabric with command docker-compose down and start it again with docker-compose start and then start my chaincode program, I found that the whole data which was written before the restart is gone. I couldn't find any data in my blockchain.

How can I avoid this behavior of Hyperledger? I am running it on a single peer/node. With multiple peers, if one of the peers restarted, then data/transactions from other peers get copied on it. But consider the worst scenario when all peers down. Does that mean we lose all our data?

1 Answer

0 votes
by (14.4k points)
edited by

In accord with the official Docker documents that can be found on its website, 

docker-compose down actually terminates and erases all docker containers listed in the docker-compose file along with volumes. 

Docker-compose stop stops the execution of containers. Following that, docker-compose up preserves data.

Know more about Blockchain in detail. Enroll in IBM Blockchain Certification now to take that first step.

Browse Categories