Я учусь кодировать docker-compose.yaml для Hyperledger Fabric. Когда я пытаюсь выполнить команду «docker-compose up», я получаю следующую ошибку:
Файл Compose './docker-compose.yaml' недействителен, потому что:
Дополнительные свойства недопустимы («peer0.org2.example.com», «peer1.org2.example.com» были неожиданными)
Возможно, вы видите эту ошибку, потому что вы используете неправильную версию файла Compose. Либо укажите поддерживаемую версию («2.0», «2.1», «3.0») и поместите определения служб под ключом services
, либо опустите ключ version
и поместите определения служб в корень файла, который вы хотите использовать. Версия 1
Подробнее о версиях формата файлов Compose см. 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