Launching a sample trade network
So, now that we have all the configuration for our network, and also the channel artifacts and cryptographic material required to run it, all we need to do is start the network using the docker-compose command, as follows:
docker-compose -f docker-compose-e2e.yaml up
You can run this as a background process and redirect the standard output to a log file if you so choose. Otherwise, you will see the various containers starting up and logs from each displayed on the console.
Note that on some OS configurations, setting up Fabric can be tricky. If you run into problems, consult the documentation. A detailed description of how to install a Fabric network and examples is provided at https://hyperledger-fabric.readthedocs.io/en/release-1.1/samples.html.
The network can be launched in the background using our trade.sh script as well; just run:
./trade.sh up
From a different terminal window, if you run docker ps -a, you will see something as follows:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e636f0054fc hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.carrierorg.trade.com
28c18b76dbe8 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.importerorg.trade.com
9308ad203362 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:7054->7054/tcp ca_peerExporterOrg
754018a3875e hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:8054->7054/tcp ca_peerImporterOrg
09a45eca60d5 hyperledger/fabric-orderer:latest "orderer" 3 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp orderer.trade.com
f86e50e6fc76 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.exporterorg.trade.com
986c478a522a hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:9054->7054/tcp ca_peerCarrierOrg
66f90036956a hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer0.regulatororg.trade.com
a6478cd2ba6f hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se..." 3 minutes ago Up 3 minutes 0.0.0.0:10054->7054/tcp ca_peerRegulatorOrg
We have four peers, four MSPs, and an orderer running in separate containers. Our trade network is up and ready to run our application!
To view the running logs of a given container, note the container ID (first column in the preceding list) and simply run:
docker logs <container-ID>
To bring the network down, you can use either the docker-compose command:
docker-compose -f docker-compose-e2e.yaml down
Or our trade.sh script:
./trade.sh down