fabric-solo単機マルチノードシステム構成1


ステップ
  • 証明書ファイルの生成
  • チャネルファイル作成ブロックファイルの生成
  • docker-composeの作成
  • 各ノード
  • 始動容器
  • ログインクライアント
  • 通路の作成
  • 加入通路(各ノード)
  • インストールチェーンコード(各ノード)
  • 初期化チェーンコード(任意ノード)
  • テストチェーン

  • Orderノード:Ordererドメイン名:orderer.bank.comタイプ:solo
    組織
    ドメイン名
    peerノード
    ユーザー
    Org1
    org1.bank.com
    2つ
    3つ
    Org2
    org2.bank.com
    2つ
    1つ
    すべてのプロファイルはfabric-samples/first-networkのプロファイルを参照できます(cpからプロジェクトディレクトリへの変更可)
    1証明書ファイルを生成するcryptogen
    プロジェクトディレクトリを新規作成し、crypto-config.yamlファイルを作成し、作成が完了したらcryptogenを使用して証明書ファイルを生成します.
    sui@server_root:~/hyperledger-fabric/demo2$ pwd
    sui@server_root:~/hyperledger-fabric/demo2$ vi crypto-config.yaml
    

    証明書の生成cryptogen generate --config=crypto-config.yamlcryptogen showtemplateコマンドを使用して、プロファイルテンプレートプロファイルの内容を次のように表示します.
    # ---------------------------------------------------------------------------
    # "OrdererOrgs" - Definition of organizations managing orderer nodes
    # ---------------------------------------------------------------------------
    OrdererOrgs:
      # ---------------------------------------------------------------------------
      # Orderer
      # ---------------------------------------------------------------------------
      - Name: Orderer
        Domain: bank.com
          Specs:
          - Hostname: orderer
         
    # ---------------------------------------------------------------------------
    # "PeerOrgs" - Definition of organizations managing peer nodes
    # ---------------------------------------------------------------------------
    PeerOrgs:
      # ---------------------------------------------------------------------------
      # Org1
      # ---------------------------------------------------------------------------
      - Name: Org1
        Domain: org1.bank.com
        EnableNodeOUs: true
        Template:
          Count: 2
        Users:
          Count: 3
      # ---------------------------------------------------------------------------
      # Org2: See "Org1" for full specification
      # ---------------------------------------------------------------------------
      - Name: Org2
        Domain: org2.bank.com
        EnableNodeOUs: true
        Template:
          Count: 2
        Users:
          Count: 1
    

    生成後にcrypto-configフォルダがローカルに作成されます
    sui@server_root:~/hyperledger-fabric/demo2$ ls
    crypto-config  crypto-config.yaml
    sui@server_root:~/hyperledger-fabric/demo2$ tree crypto-config -L 3
    crypto-config
    ├── ordererOrganizations
    │   └── bank.com
    │       ├── ca
    │       ├── msp
    │       ├── orderers
    │       ├── tlsca
    │       └── users
    └── peerOrganizations
        ├── org1.bank.com
        │   ├── ca
        │   ├── msp
        │   ├── peers
        │   ├── tlsca
        │   └── users
        └── org2.bank.com
            ├── ca
            ├── msp
            ├── peers
            ├── tlsca
            └── users
    

    2チャネルと創世ブロックファイルの生成-configtxgen
    ディレクトリにファイルをコピーしconfigtx.yamlを編集
    sui@server_root:~/hyperledger-fabric/demo2$ cp ../fabric-samples/first-network/configtx.yaml .
    sui@server_root:~/hyperledger-fabric/demo2$ vi configtx.yaml 
    

    チャネルファイルを生成する--profile接続プロファイルの定義変数名Profiles:configtxgen -profile TwoOrgsChannel -outputCreateChannelTx channel.tx -channelID mychannel創世ブロックファイルを生成するconfigtxgen -profile TwoOrgsOrdererGenesis -outputBlock genesis.blockその後、2つのファイルが生成されます.1つの創世ブロックgenesis.block、1つのチャネルファイルchannel.tx、作成したチャネル名mychannnelを覚えてください
    sui@server_root:~/hyperledger-fabric/demo2$ ls
    channel.tx  configtx.yaml  crypto-config  crypto-config.yaml  genesis.block
    sui@server_root:~/hyperledger-fabric/demo2$ 
    

    プロファイルは次のとおりです.
    
    Organizations:
        - &OrdererOrg  
            Name: OrdererOrg      
            ID: OrdererMSP
            MSPDir: crypto-config/ordererOrganizations/bank.com/msp
    
            Policies:
                Readers:
                    Type: Signature
                    Rule: "OR('OrdererMSP.member')"
                Writers:
                    Type: Signature
                    Rule: "OR('OrdererMSP.member')"
                Admins:
                    Type: Signature
                    Rule: "OR('OrdererMSP.admin')"
    
        - &Org1  
            Name: Org1MSP
            ID: Org1MSP
            MSPDir: crypto-config/peerOrganizations/org1.bank.com/msp
    
            Policies:
                Readers:
                    Type: Signature
                    Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
                Writers:
                    Type: Signature
                    Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
                Admins:
                    Type: Signature
                    Rule: "OR('Org1MSP.admin')"
    
            AnchorPeers:           
                - Host: peer0.org1.bank.com
                  Port: 7051
    
        - &Org2        
            Name: Org2MSP      
            ID: Org2MSP
            MSPDir: crypto-config/peerOrganizations/org2.bank.com/msp     
            Policies:
                Readers:
                    Type: Signature
                    Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
                Writers:
                    Type: Signature
                    Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
                Admins:
                    Type: Signature
                    Rule: "OR('Org2MSP.admin')"
    
            AnchorPeers:
                - Host: peer0.org2.bank.com
                  Port: 7051
    
    ################################################################################
    #
    #   SECTION: Capabilities
    #
    ################################################################################
    Capabilities:
        # Channel capabilities apply to both the orderers and the peers and must be
        # supported by both.
        # Set the value of the capability to true to require it.
        Channel: &ChannelCapabilities
            # V1.3 for Channel is a catchall flag for behavior which has been
            # determined to be desired for all orderers and peers running at the v1.3.x
            # level, but which would be incompatible with orderers and peers from
            # prior releases.
            # Prior to enabling V1.3 channel capabilities, ensure that all
            # orderers and peers on a channel are at v1.3.0 or later.
            V1_3: true
    
        # Orderer capabilities apply only to the orderers, and may be safely
        # used with prior release peers.
        # Set the value of the capability to true to require it.
        Orderer: &OrdererCapabilities
            # V1.1 for Orderer is a catchall flag for behavior which has been
            # determined to be desired for all orderers running at the v1.1.x
            # level, but which would be incompatible with orderers from prior releases.
            # Prior to enabling V1.1 orderer capabilities, ensure that all
            # orderers on a channel are at v1.1.0 or later.
            V1_1: true
    
        # Application capabilities apply only to the peer network, and may be safely
        # used with prior release orderers.
        # Set the value of the capability to true to require it.
        Application: &ApplicationCapabilities
            # V1.3 for Application enables the new non-backwards compatible
            # features and fixes of fabric v1.3.
            V1_3: true
            # V1.2 for Application enables the new non-backwards compatible
            # features and fixes of fabric v1.2 (note, this need not be set if
            # later version capabilities are set)
            V1_2: false
            # V1.1 for Application enables the new non-backwards compatible
            # features and fixes of fabric v1.1 (note, this need not be set if
            # later version capabilities are set).
            V1_1: false
    
    ################################################################################
    #
    #   SECTION: Application
    #
    #   - This section defines the values to encode into a config transaction or
    #   genesis block for application related parameters
    #
    ################################################################################
    Application: &ApplicationDefaults
    
        # Organizations is the list of orgs which are defined as participants on
        # the application side of the network
        Organizations:
    
        # Policies defines the set of policies at this level of the config tree
        # For Application policies, their canonical path is
        #   /Channel/Application/
        Policies:
            Readers:
                Type: ImplicitMeta
                Rule: "ANY Readers"
            Writers:
                Type: ImplicitMeta
                Rule: "ANY Writers"
            Admins:
                Type: ImplicitMeta
                Rule: "MAJORITY Admins"
    
        Capabilities:
            <<: section:="" orderer="" this="" section="" defines="" the="" values="" to="" encode="" into="" a="" config="" transaction="" or="" genesis="" block="" for="" related="" parameters="" orderer:="" orderertype:="" solo="" addresses:="" orderer.bank.com:7050="" batchtimeout:="" batchsize:="" maxmessagecount:="" absolutemaxbytes:="" mb="" preferredmaxbytes:="" kb="" kafka:="" brokers:="" list="" of="" kafka="" brokers="" which="" connects="" note:="" use="" ip:port="" notation="" organizations="" is="" orgs="" are="" defined="" as="" participants="" on="" side="" network="" organizations:="" policies:="" readers:="" type:="" implicitmeta="" rule:="" readers="" writers:="" writers="" admins:="" admins="" blockvalidation:="" channel="" parameters.="" channel:="" policies="" set="" at="" level="" tree="" their="" canonical="" path="">
        Policies:
            # Who may invoke the 'Deliver' API
            Readers:
                Type: ImplicitMeta
                Rule: "ANY Readers"
            # Who may invoke the 'Broadcast' API
            Writers:
                Type: ImplicitMeta
                Rule: "ANY Writers"
            # By default, who may modify elements at this config level
            Admins:
                Type: ImplicitMeta
                Rule: "MAJORITY Admins"
    
        # Capabilities describes the channel level capabilities, see the
        # dedicated Capabilities section elsewhere in this file for a full
        # description
        Capabilities:
            <<: profile="" different="" configuration="" profiles="" may="" be="" encoded="" here="" to="" specified="" as="" parameters="" the="" configtxgen="" tool="" profiles:="" twoorgsorderergenesis:="" orderer:="" organizations:="" capabilities:="" consortiums:="" sampleconsortium:="" twoorgschannel:="" consortium:="" sampleconsortium="" application:="" sampledevmodekafka:="" orderertype:="" kafka="" kafka:="" brokers:="" kafka.bank.com:9092=""/>

    2 docker-composeの作成
    まずdockerデータボリュームのマウントについて、composeファイルは大量のデータマウントを使用しています.composeファイルを作成するとfirst-networkのdemoを表示できます.
    sui@server_root:~/hyperledger-fabric/fabric-samples/first-network$ tree
    .
    ├── base #docker-compose  base   yaml
    │   ├──docker-compose-base.yaml   peer-base.yaml
    │   └── peer-base.yaml
    ├── channel-artifacts #    ,       ,      
    ├── configtx.yaml
    ├── crypto-config.yaml
    ├── docker-compose-cli.yaml #compose    ,       
    

    docker-compose-base.yamlでgenesis.blockデータをデフォルトでchannel-artifactsフォルダにマウントし、このディレクトリを変更するか、前に生成した創世ブロックファイルとチャネルファイルをサブディレクトリにcpする(channel-artifactsを自分で作成する)、または後で創世ブロックを生成するときにchannel-artifactsディレクトリに直接生成します.
       volumes:
        - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
    

    この例では、プロファイルの変更を少なくするために、以前に生成された創世ブロックとチャネルファイルをこのディレクトリにコピーし、base/*とdocker-compose-cli.yamlをプロジェクトディレクトリにコピーします.
    sui@server_root:~/hyperledger-fabric/demo2$ tree -L 2
    .
    ├── base
    │   ├── docker-compose-base.yaml
    │   └── peer-base.yaml
    ├── channel-artifacts
    │   ├── channel.tx
    │   └── genesis.block
    ├── configtx.yaml
    ├── crypto-config
    │   ├── ordererOrganizations
    │   └── peerOrganizations
    ├── crypto-config.yaml
    └── docker-compose-cli.yaml
    
    docker-compose-cli.yaml
    version: '2'
    volumes:
      orderer.bank.com:
      peer0.org1.bank.com:
      peer1.org1.bank.com:
      peer0.org2.bank.com:
      peer1.org2.bank.com:
    
    networks:
      byfn:
    
    services:
      orderer.bank.com:
        extends:
          file:   base/docker-compose-base.yaml
          service: orderer.bank.com
        container_name: orderer.bank.com
        networks:
          - byfn
    
      peer0.org1.bank.com:
        container_name: peer0.org1.bank.com
        extends:
          file:  base/docker-compose-base.yaml
          service: peer0.org1.bank.com
        networks:
          - byfn
    
      peer1.org1.bank.com:
        container_name: peer1.org1.bank.com
        extends:
          file:  base/docker-compose-base.yaml
          service: peer1.org1.bank.com
        networks:
          - byfn
    
      peer0.org2.bank.com:
        container_name: peer0.org2.bank.com
        extends:
          file:  base/docker-compose-base.yaml
          service: peer0.org2.bank.com
        networks:
          - byfn
    
      peer1.org2.bank.com:
        container_name: peer1.org2.bank.com
        extends:
          file:  base/docker-compose-base.yaml
          service: peer1.org2.bank.com
        networks:
          - byfn
    
      cli:
        container_name: cli
        image: hyperledger/fabric-tools:$IMAGE_TAG
        tty: true
        stdin_open: true
        environment:
          - GOPATH=/opt/gopath
          - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
          #- FABRIC_LOGGING_SPEC=DEBUG
          - FABRIC_LOGGING_SPEC=INFO
          - CORE_PEER_ID=cli
          - CORE_PEER_ADDRESS=peer0.org1.bank.com:7051
          - CORE_PEER_LOCALMSPID=Org1MSP
          - CORE_PEER_TLS_ENABLED=true
          - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bank.com/peers/peer0.org1.bank.com/tls/server.crt
          - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bank.com/peers/peer0.org1.bank.com/tls/server.key
          - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bank.com/peers/peer0.org1.bank.com/tls/ca.crt
          - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bank.com/users/[email protected]/msp
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
        command: /bin/bash
        volumes:
            - /var/run/:/host/var/run/
            - ./../chaincode/:/opt/gopath/src/github.com/chaincode
            - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
            - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
            - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
        depends_on:
          - orderer.bank.com
          - peer0.org1.bank.com
          - peer1.org1.bank.com
          - peer0.org2.bank.com
          - peer1.org2.bank.com
        networks:
          - byfn
    
    base/docker-compose-base
    version: '2'
    services:
      orderer.bank.com:
        container_name: orderer.bank.com
        image: hyperledger/fabric-orderer:$IMAGE_TAG
        environment:
          - FABRIC_LOGGING_SPEC=INFO
          - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
          - ORDERER_GENERAL_GENESISMETHOD=file
          - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
          - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
          - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
          # enabled TLS
          - ORDERER_GENERAL_TLS_ENABLED=true
          - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
          - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
          - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
          - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
          - ORDERER_KAFKA_VERBOSE=true
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric
        command: orderer
        volumes:
        - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ../crypto-config/ordererOrganizations/bank.com/orderers/orderer.bank.com/msp:/var/hyperledger/orderer/msp
        - ../crypto-config/ordererOrganizations/bank.com/orderers/orderer.bank.com/tls/:/var/hyperledger/orderer/tls
        - orderer.bank.com:/var/hyperledger/production/orderer
        ports:
          - 7050:7050
    
      peer0.org1.bank.com:
        container_name: peer0.org1.bank.com
        extends:
          file: peer-base.yaml
          service: peer-base
        environment:
          - CORE_PEER_ID=peer0.org1.bank.com
          - CORE_PEER_ADDRESS=peer0.org1.bank.com:7051
          - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.bank.com:7051
          - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.bank.com:7051
          - CORE_PEER_LOCALMSPID=Org1MSP
        volumes:
            - /var/run/:/host/var/run/
            - ../crypto-config/peerOrganizations/org1.bank.com/peers/peer0.org1.bank.com/msp:/etc/hyperledger/fabric/msp
            - ../crypto-config/peerOrganizations/org1.bank.com/peers/peer0.org1.bank.com/tls:/etc/hyperledger/fabric/tls
            - peer0.org1.bank.com:/var/hyperledger/production
        ports:
          - 7051:7051
          - 7053:7053
    
      peer1.org1.bank.com:
        container_name: peer1.org1.bank.com
        extends:
          file: peer-base.yaml
          service: peer-base
        environment:
          - CORE_PEER_ID=peer1.org1.bank.com
          - CORE_PEER_ADDRESS=peer1.org1.bank.com:7051
          - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.bank.com:7051
          - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.bank.com:7051
          - CORE_PEER_LOCALMSPID=Org1MSP
        volumes:
            - /var/run/:/host/var/run/
            - ../crypto-config/peerOrganizations/org1.bank.com/peers/peer1.org1.bank.com/msp:/etc/hyperledger/fabric/msp
            - ../crypto-config/peerOrganizations/org1.bank.com/peers/peer1.org1.bank.com/tls:/etc/hyperledger/fabric/tls
            - peer1.org1.bank.com:/var/hyperledger/production
    
        ports:
          - 8051:7051
          - 8053:7053
    
      peer0.org2.bank.com:
        container_name: peer0.org2.bank.com
        extends:
          file: peer-base.yaml
          service: peer-base
        environment:
          - CORE_PEER_ID=peer0.org2.bank.com
          - CORE_PEER_ADDRESS=peer0.org2.bank.com:7051
          - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.bank.com:7051
          - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.bank.com:7051
          - CORE_PEER_LOCALMSPID=Org2MSP
        volumes:
            - /var/run/:/host/var/run/
            - ../crypto-config/peerOrganizations/org2.bank.com/peers/peer0.org2.bank.com/msp:/etc/hyperledger/fabric/msp
            - ../crypto-config/peerOrganizations/org2.bank.com/peers/peer0.org2.bank.com/tls:/etc/hyperledger/fabric/tls
            - peer0.org2.bank.com:/var/hyperledger/production
        ports:
          - 9051:7051
          - 9053:7053
    
      peer1.org2.bank.com:
        container_name: peer1.org2.bank.com
        extends:
          file: peer-base.yaml
          service: peer-base
        environment:
          - CORE_PEER_ID=peer1.org2.bank.com
          - CORE_PEER_ADDRESS=peer1.org2.bank.com:7051
          - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.bank.com:7051
          - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.bank.com:7051
          - CORE_PEER_LOCALMSPID=Org2MSP
        volumes:
            - /var/run/:/host/var/run/
            - ../crypto-config/peerOrganizations/org2.bank.com/peers/peer1.org2.bank.com/msp:/etc/hyperledger/fabric/msp
            - ../crypto-config/peerOrganizations/org2.bank.com/peers/peer1.org2.bank.com/tls:/etc/hyperledger/fabric/tls
            - peer1.org2.bank.com:/var/hyperledger/production
        ports:
          - 10051:7051
          - 10053:7053
    
    base-peer-base変更なし、注意起動時にIMAGE_TAG環境変数を設定するか、IMAGE_TAGを削除する
    version: '2'
    services:
      peer-base:
        image: hyperledger/fabric-peer:$IMAGE_TAG
        environment:
          - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
          # the following setting starts chaincode containers on the same
          # bridge network as the peers
          # https://docs.docker.com/compose/networking/
          - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
          - FABRIC_LOGGING_SPEC=INFO
          #- FABRIC_LOGGING_SPEC=DEBUG
          - CORE_PEER_TLS_ENABLED=true
          - CORE_PEER_GOSSIP_USELEADERELECTION=true
          - CORE_PEER_GOSSIP_ORGLEADER=false
          - CORE_PEER_PROFILE_ENABLED=true
          - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
          - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
          - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
        command: peer node start
    

    3 dockers-composeの起動
    peer-baseファイルでIMAGE_TAG環境変数を参照します.ここではlatestを使用します.設定しないとdockers imageエラーが発生したり、peer-baseの環境変数を削除したりします.デフォルトではlatestを使用します.
    sui@server_root:~/hyperledger-fabric/demo2$ export IMAGE_TAG=latest
    sui@server_root:~/hyperledger-fabric/demo2$ docker-compose -f docker-compose-cli.yaml up -d
    WARNING: The COMPOSE_PROJECT_NAME variable is not set. Defaulting to a blank string.
    Creating peer1.org2.bank.com ... done
    Creating orderer.bank.com    ... done
    Creating peer0.org2.bank.com ... done
    Creating peer0.org1.bank.com ... done
    Creating peer1.org1.bank.com ... done
    Creating cli                 ... done
    sui@server_root:~/hyperledger-fabric/demo2$ docker-compose -f docker-compose-cli.yaml ps 
    WARNING: The COMPOSE_PROJECT_NAME variable is not set. Defaulting to a blank string.
           Name               Command       State                        Ports                      
    ------------------------------------------------------------------------------------------------
    cli                   /bin/bash         Up                                                      
    orderer.bank.com      orderer           Up      0.0.0.0:7050->7050/tcp                          
    peer0.org1.bank.com   peer node start   Up      0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp  
    peer0.org2.bank.com   peer node start   Up      0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp  
    peer1.org1.bank.com   peer node start   Up      0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp  
    peer1.org2.bank.com   peer node start   Up      0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp
    

    合計6つのdockersコンテナ、1つのクライアントcli、1つのorderソートノード、4つのpeerノードが起動されました.コンテナを起動するたびに-fパラメータを追加しないために、ocker-compose-cli.yamlをocker-compose.yamlと命名し、docker-composeデフォルトでサブファイルを検索できます.
    コンテナを閉じる
    sui@server_root:~/hyperledger-fabric/demo2$ docker-compose -f docker-compose-cli.yaml down
    WARNING: The COMPOSE_PROJECT_NAME variable is not set. Defaulting to a blank string.
    Stopping cli                 ... done
    Stopping peer1.org1.bank.com ... done
    Stopping peer0.org1.bank.com ... done
    Stopping peer0.org2.bank.com ... done
    Stopping orderer.bank.com    ... done
    Stopping peer1.org2.bank.com ... done
    Removing cli                 ... done
    Removing peer1.org1.bank.com ... done
    Removing peer0.org1.bank.com ... done
    Removing peer0.org2.bank.com ... done
    Removing orderer.bank.com    ... done
    Removing peer1.org2.bank.com ... done
    Removing network demo2_byfn
    

    ファイルの名前を変更し、コンテナを再起動
    sui@server_root:~/hyperledger-fabric/demo2$ mv docker-compose-cli.yaml docker-compose.yaml     
    sui@server_root:~/hyperledger-fabric/demo2$ docker-compose up -d
    WARNING: The COMPOSE_PROJECT_NAME variable is not set. Defaulting to a blank string.
    Creating network "demo2_byfn" with the default driver
    Creating peer1.org1.bank.com ... done
    Creating orderer.bank.com    ... done
    Creating peer1.org2.bank.com ... done
    Creating peer0.org2.bank.com ... done
    Creating peer0.org1.bank.com ... done
    Creating cli                 ... done
    sui@server_root:~/hyperledger-fabric/demo2$ 
    

    次のセクションではpeerノードの操作について説明します