How it works...

Here, we deployed the chaincode to the peer node. Let's now take a look at how chaincode-docker-devmode defines the blockchain configuration. chaincode-docker-devmode has some predefined configuration files and scripts.  Here are the files in chaincode-docker-devmode:

Let's take a closer look at the docker-compose-simple.yaml file:

  • This file defines services, peer, cli, and chaincode container configuration.
  • Services define the orderer service with the container name as port 7050. It points to the Docker image at hyperledger/fabric-orderer.
  • Peer defines a peer node. The peer container port is 7051. It points to a Docker image at hyperledger/fabric-peer.
  • The cli section defines the cli container name as cli. The cli container can issue a command to interact with the chaincode deployed in the peer node. It points to a Docker image at hyperledger/fabric-tools
  • The chaincode container defines the container name as chaincode. It points to a Docker image at hyperledger/fabric-ccenv

Here is the screenshot we see after we bring up the Docker containers. We can see the previously mentioned four containers running:

The script file in chaincode-docker-devmode only contains the following two commands:

peer channel create -c myc -f myc.tx -o orderer:7050
peer channel join -b myc.block

The first command creates the myc channel using the specified configuration file in the myc.tx file. The myc.tx file is generated by the configtxgen tool. This tool also generates orderer.block

The second command joins the created channel with  myc.block to the cli container. With these four containers, we can deploy our chaincode to the Fabric in the development environment.

Let's now carry out some tests from the cli container.