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 container knows rbenv global but not ruby
  • Symfony docker container can't connect to Mysql
  • How to know if docker is already logged in to a docker registry server
  • Docker Compose remove containers started using docker run
  • How kubelet - docker container communication happens?
  • Docker run -d <private image> gives fatal. On other hosts it's ok?
  • 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).

  • Setting Mesos DNS on ubuntu
  • Minimize CentOS-based Docker image
  • Docker Permission Denied Only on RHEL 6.6
  • Copy files between docker machines
  • install and Run Kurento Media server in Cent OS 6.6 using Docker
  • How to customize virtualbox configuration using docker-machine?
  • 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:

    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
    

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

    https://github.com/joequant/hyperledger

    and

    https://github.com/yeasy/docker-hyperledger-peer

    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.