Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

The hyperledger project has a built-in Docker image definition for running peer nodes. Given the vagrant focused development environment documentation, it's not immediately obvious that you can set up your own chain network using docker-compose.

To do that, first build the docker image by running this test (this test step is entirely dedicated to building the image):

go test github.com/hyperledger/fabric/core/container -run=BuildImage_Peer

Once the image is built, use docker-compose to launch the peer nodes. This folder has some pre-built YAML files for docker-compose:

github.com/hyperledger/fabric/bddtests

Use the following command to launch 3 peers (for instance):

docker-compose -f docker-compose-3.yml up --force-recreate -d

After the container instances are up, use docker inspect to get the IP addresses and use port 5000 to call the REST APIs (refer to the documentation for REST API spec).

1 Answer

0 votes
by (29.5k points)

Hi, I don't see a question anywhere although its a nice observation, I wanted to add that  You can look in the hyperledger/fabric github repository under the ./bddtests and ./consensus/docker-compose-files directories for examples on how to setup peer networks of 3, 4 or 5 nodes.

Remember to expose port 5000 for one of the validating peers so that you can use the REST
api to interact with the peer node.

Browse Categories

...