concept file in category hyperledger

appears as: files, file, The file, files, file
Programming Hyperledger Fabric: Creating Permissioned Blockchains

This is an excerpt from Manning's book Programming Hyperledger Fabric: Creating Permissioned Blockchains.

Within Docker there are several ways one can go about containerization. From simplest to most advanced these are containers, services, or stacks. Container is the smallest unit. A Docker service is used to run multiple identical copies of an application in multiple containers (aka horizontal scaling) and Docker stack is a powerful way to manage an application composed of multiple services. We will create containers in this book without using any abstraction layer provided by a service or a stack. The problem using Docker services is that there is no way to copy some files (such as private-public keys and X.509 certificates) to the container before it starts. With standalone containers one can create the container, perform some intermediate steps such as copying files to the container, and then start the container. If you are using services you will either need to use what are known as bind mounts or some other means to inject any credentials or config into the container at runtime.

Listing 9.11. Running peer node inside a Docker container. There are 3 stages. Stage 1: create container. Stage 2: copy files into container. Stage 3: run container. The environment variables needed to start the peer are not shown.
$ docker container create \
--name peer0.biotor.com \
--network pharmanet \
--volume $PWD/../three-org-network/peer0.Biotor.com:/var/hyperledger/production \   #1
--volume /var/run/:/host/var/run/ \   #2
--workdir /home \
--log-opt max-file=3 \
--log-opt max-size=10m \
-p 8051:8051 \   #3
-p 8052:8052 \   #3
hyperledger/fabric-peer:2.0.1 \                       #4
peer node start                                       #5

$ docker cp $PWD/../three-org-network/crypto-config/peerOrganizations/Biotor.com/peers/peer0.Biotor.com/msp peer0.biotor.com:/home/msp   #6

$ docker start peer0.biotor.com   #7

We will now explain what the above code does. It will illustrate many Docker concepts such as volumes, port publishing, log rotation and copying files between host and container.