如何修复Docker-Compose(Hyperledger Fabric)中的“撰写文件'./docker-compose.yaml'无效,因为”错误?

时间:2019-06-13 13:04:43

标签: docker docker-compose yaml hyperledger-fabric hyperledger

我正在学习为Hyperledger Fabric编码docker-compose.yaml。当我尝试运行命令“ docker-compose up”时,出现以下错误:

撰写文件'./docker-compose.yaml'无效,因为: 不允许使用其他属性(“ peer0.org2.example.com”,“ peer1.org2.example.com”是意外的)

您可能会看到此错误,因为使用的是错误的Compose文件版本。指定受支持的版本(“ 2.0”,“ 2.1”,“ 3.0”)并将您的服务定义放在services键下,或者省略version键并将您的服务定义放在根目录下要使用版本1的文件。 有关撰写文件格式版本的更多信息,请参见https://docs.docker.com/compose/compose-file/

我正在使用docker-compose版本1.10.0,内部版本4bd6f1a 我曾尝试升级到不同版本的docker-compose,但没有一个起作用。 我还尝试修复缩进。

    version: "2"
    networks:
      default: null
    services:
      orderer.example.com:
        image: 'hyperledger/fabric-orderer:x86_64-1.0.5'
        container_name: orderer.example.com
        environment:
          - ORDERER_GENERAL_LOGLEVEL=debug
          - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
          - ORDERER_GENERAL_LISTENPORT=7050
          - ORDERER_GENERAL_GENESISPROFILE=Example
          - ORDERER_GENERAL_GENESISMETHOD=file
          - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
          - ORDERER_GENERAL_LOCALMSPID=example.com
          - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
          - 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]'
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric
        command: orderer
        volumes:
          - './channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block'
          - './crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp'
          - './crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls:/var/hyperledger/orderer/tls'
        ports:
          - '7050:7050'
        networks:
          default:
            aliases:
              - orderer.example.com
      ca.org1.example.com:
        image: 'hyperledger/fabric-ca:x86_64-1.0.5'
        container_name: ca.org1.example.com
        environment:
          - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
          - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com
          - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
          - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/771ad840d46bfcfb4c523c7cf10039c09fc42571e7d305b66ae7f0dda954d78e_sk
          - FABRIC_CA_SERVER_TLS_ENABLED=true
          - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
          - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/771ad840d46bfcfb4c523c7cf10039c09fc42571e7d305b66ae7f0dda954d78e_sk
        ports:
          - '7054:7054'
        command: 'sh -c ''fabric-ca-server start -b admin:adminpw -d'''
        volumes:
          - './crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config'
        networks:
          default:
            aliases:
              - ca.org1.example.com
      ca.org2.example.com:
        image: 'hyperledger/fabric-ca:x86_64-1.0.5'
        container_name: ca.org2.example.com
        environment:
          - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
          - FABRIC_CA_SERVER_CA_NAME=ca.org2.example.com
          - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
          - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/83b0a1364897e72470f73ebc018b8ea23ab8d310acb380831f8aa5207b6dc529_sk
          - FABRIC_CA_SERVER_TLS_ENABLED=true
          - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
          - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/83b0a1364897e72470f73ebc018b8ea23ab8d310acb380831f8aa5207b6dc529_sk
        ports:
          - '8054:7054'
        command: 'sh -c ''fabric-ca-server start -b admin:adminpw -d'''
        volumes:
          - './crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config'
        networks:
          default:
            aliases:
              - ca.org2.example.com
      peer0.org1.example.com:
        image: 'hyperledger/fabric-peer:x86_64-1.0.5'
        container_name: peer0.org1.example.com
        environment:
          - 'CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock'
          - CORE_VM_DOCKER_ATTACHSTDOUT=true
          - CORE_LOGGING_LEVEL=DEBUG
          - CORE_PEER_NETWORKID=Example
          - CORE_PEER_PROFILE_ENABLED=true
          - CORE_PEER_TLS_ENABLED=true
          - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
          - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
          - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
          - CORE_PEER_ID=peer0.org1.example.com
          - CORE_PEER_ADDRESSAUTODETECT=true
          - 'CORE_PEER_ADDRESS=peer0.org1.example.com:7051'
          - 'CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051'
          - CORE_PEER_GOSSIP_USELEADERELECTION=true
          - CORE_PEER_GOSSIP_ORGLEADER=false
          - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
          - CORE_PEER_LOCALMSPID=org1.example.com
          - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
          - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0.org1.example.com
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
        command: 'peer node start'
        volumes:
          - '/var/run/:/host/var/run/'
          - './crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/var/hyperledger/msp'
          - './crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/var/hyperledger/tls'
        ports:
          - '7051:7051'
          - '7053:7053'
        depends_on:
          - orderer.example.com
        links:
          - orderer.example.com
        networks:
          default:
            aliases:
              - peer0.org1.example.com
      peer1.org1.example.com:
        image: 'hyperledger/fabric-peer:x86_64-1.0.5'
        container_name: peer1.org1.example.com
        environment:
          - 'CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock'
          - CORE_VM_DOCKER_ATTACHSTDOUT=true
          - CORE_LOGGING_LEVEL=DEBUG
          - CORE_PEER_NETWORKID=Example
          - CORE_PEER_PROFILE_ENABLED=true
          - CORE_PEER_TLS_ENABLED=true
          - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
          - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
          - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
          - CORE_PEER_ID=peer1.org1.example.com
          - CORE_PEER_ADDRESSAUTODETECT=true
          - 'CORE_PEER_ADDRESS=peer1.org1.example.com:7051'
          - 'CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051'
          - CORE_PEER_GOSSIP_USELEADERELECTION=true
          - CORE_PEER_GOSSIP_ORGLEADER=false
          - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
          - CORE_PEER_LOCALMSPID=org1.example.com
          - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
          - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1.org1.example.com
        working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
        command: 'peer node start'
        volumes:
          - '/var/run/:/host/var/run/'
          - './crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/var/hyperledger/msp'
          - './crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/var/hyperledger/tls'
        ports:
          - '8051:7051'
          - '8053:7053'
        depends_on:
          - orderer.example.com
        links:
          - orderer.example.com
        networks:
          default:
            aliases:
              - peer1.org1.example.com

    peer0.org2.example.com:
      image: 'hyperledger/fabric-peer:x86_64-1.0.5'
      container_name: peer0.org2.example.com
      environment:
        - 'CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock'
        - CORE_VM_DOCKER_ATTACHSTDOUT=true
        - CORE_LOGGING_LEVEL=DEBUG
        - 'CORE_PEER_NETWORKID= Example'
        - CORE_PEER_PROFILE_ENABLED=true
        - CORE_PEER_TLS_ENABLED=true
        - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
        - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
        - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
        - CORE_PEER_ID=peer0.org2.example.com
        - CORE_PEER_ADDRESSAUTODETECT=true
        - 'CORE_PEER_ADDRESS=peer0.org2.example.com:7051'
        - 'CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051'
        - CORE_PEER_GOSSIP_USELEADERELECTION=true
        - CORE_PEER_GOSSIP_ORGLEADER=false
        - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
        - CORE_PEER_LOCALMSPID=org2.example.com
        - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
        - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0.org2.example.com
      working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
      command: 'peer node start'
      volumes:
        - '/var/run/:/host/var/run/'
        - './crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/var/hyperledger/msp'
        - './crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/var/hyperledger/tls'
      ports:
        - '9051:7051'
        - '9053:7053'
      depends_on:
        - orderer.example.com
      links:
        - orderer.example.com
      networks:
        default:
          aliases:
            - peer0.org2.example.com

    peer1.org2.example.com:
      image: 'hyperledger/fabric-peer:x86_64-1.0.5'
      container_name: peer1.org2.example.com
      environment:
        - 'CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock'
        - CORE_VM_DOCKER_ATTACHSTDOUT=true
        - CORE_LOGGING_LEVEL=DEBUG
        - 'CORE_PEER_NETWORKID= Example'
        - CORE_PEER_PROFILE_ENABLED=true
        - CORE_PEER_TLS_ENABLED=true
        - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
        - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
        - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
        - CORE_PEER_ID=peer1.org2.example.com
        - CORE_PEER_ADDRESSAUTODETECT=true
        - 'CORE_PEER_ADDRESS=peer1.org2.example.com:7051'
        - 'CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051'
        - CORE_PEER_GOSSIP_USELEADERELECTION=true
        - CORE_PEER_GOSSIP_ORGLEADER=false
        - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
        - CORE_PEER_LOCALMSPID=org2.example.com
        - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
        - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1.org2.example.com
      working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
      command: 'peer node start'
      volumes:
        - '/var/run/:/host/var/run/'
        - './crypto-config/peerOrganizations/org2.example.com/
        peers/peer1.org2.example.com/msp:/var/hyperledger/msp'
        - './crypto-config/peerOrganizations/org2.example.com/peers/
        peer1.org2.example.com/tls:/var/hyperledger/tls'
      ports:
        - '10051:7051'
        - '10053:7053'
      depends_on:
        - orderer.example.com
      links:
        - orderer.example.com
      networks:
        default:
          aliases:
            - peer1.org2.example.com

0 个答案:

没有答案