This blog is part of series that we are writing to explain the different files involved in setting up Hyperledger Fabric network.
- Understand crypto-config.yaml file : Used to create cryptography material.
- Configtx.yaml file: Used to create genesis block and channel.
- Understand docker-compose.yaml file: Used to create docker container.
In this blog, we will explain about docker-compose.yaml file. In Hyperledger Fabric network we have couple of docker container running , like one container for certificate authority, one for peer node, one for Orderer and so on.
These container are defined in docker-compose.yaml file. You will not see any file with exact file name docker-compose, you see different docker-compose.yaml file for peers, separate file for counchDB, separate for CA etc.
In this post, we will explain about this docker-compose.yaml file.
There are mainly below sections in docker-compose.yaml file.
- Certificate Authority container
- Peer container
- Orderer container
- CounchDB container
This section define the version and the network name as shown below.
Certificate Authority Container
This section contains the details about certificate authority (CA) container. Example is shown below.
Here ca0 is the host.
Values under environment are the environment variables.
container_name is docker container name.
network is the network to that this container belong.
This section contains the details about peer container. Below is one of the example. Thing to note down here is that , main file is referring to other base files.
As you see in below first section, container_name is name of the container and this has reference to base/docker-compose-base.yaml.
Section 2 refer to base/docker-compose-base.yaml file where it extends the peer-base.yaml file.
Third section is from peer-base.yaml file.
This section contains the details about orderer container. Below is one of the example where main file is referring to base/docker-compose--base.yaml file.
This section contains the counchDB container. Below is one of the example for that.
Create Docker Containers
Run below command to create required docker containers
docker-compose -f docker-compose-e2e.yaml up