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):

  • Docker on Windows Nano Server: There is not enough space on the disk
  • Why some entries are missing in Perl ENV hash
  • Enabling webpack hot-reload in a docker application
  • How is a data-only container in Docker getting data?
  • NFS in Docker: exportfs: <path> does not support NFS export
  • How to connect Docker Swarm to multiple consul servers for failover?
  • go test -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).

  • Possible? How to setup VNC in a Google Managed VM Environment
  • Docker containers can't access local network DNS
  • Can I run Docker in a Virtual Machine?
  • Use Docker in Linux VMWare VM with Volumes?
  • Obtain ID of just-built image
  • Cannot ssh into remote machine after rsync
  • 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 docker-compose up:

    image: hyperledger/fabric-peer
    - "5000:5000"
    command: peer node start

    There are two github repositories that let you build docker images with hyperledger that you can run directly


    Under yeasy there are some repositories that contain fabric deploy scripts.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.