Manually starting hyperledger peers using docker images
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:
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).
3 Solutions collect form web for “Manually starting hyperledger peers using docker images”
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.
Now that the Hyperledger Fabric project has published its inaugural release (v0.5-developer-preview), we have begun publishing official Hyperledger docker images for the fabric-baseimage, fabric-peer and fabric-membersrvc.
These images can be deployed, as noted by other respondents, using docker-compose. As noted above in the response by @tuand, the fabric/bddtests are a good source of compose files that could be repurposed.
Note that if running on a Mac or Windows using Docker for Mac(beta) that you’ll need to use port mapping to expose ports for a peer, as Docker for Mac does not support routing IP traffic to and from containers. Container linking works as expected. Hence, you will either need to map different ports for each of the peers, or only expose a single peer instance.
The following compose file will start a single peer node on a Mac using Docker for Mac. Simply run
vp: image: hyperledger/fabric-peer ports: - "5000:5000" environment: - CORE_PEER_ADDRESSAUTODETECT=true - CORE_VM_ENDPOINT=http://127.0.0.1:2375 - CORE_LOGGING_LEVEL=DEBUG command: peer node start