Hyperledger fabric 网络中的链码问题

Chaincode problem in Hyperledger fabric network

我在启用了 TLS 的 Hyperledger fabric 中创建了一个自定义网络,我能够成功创建通道并将对等点加入通道。

但目前我遇到了一个问题:

  1. 链代码命令中的问题。

当我尝试执行以下命令时

控制台出现错误:未能认可提案:rpc 错误:代码 = 不可用 desc = 传输正在关闭

并且 peer0.org1.example.com 容器在此之后退出,日志显示如下

Version: 1.4.3
 Commit SHA: b8c4a6a
 Go version: go1.11.5
 OS/Arch: linux/amd64
 Chaincode:
  Base Image Version: 0.4.15
  Base Docker Namespace: hyperledger
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger
2021-02-17 06:14:54.102 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2021-02-17 06:14:54.105 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2021-02-17 06:14:54.345 UTC [kvledger] NewProvider -> INFO 004 ledger provider Initialized
2021-02-17 06:14:54.549 UTC [couchdb] handleRequest -> WARN 005 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:14:54.676 UTC [couchdb] handleRequest -> WARN 006 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:14:54.930 UTC [couchdb] handleRequest -> WARN 007 Retrying couchdb request in 500ms. Attempt:3  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:14:55.432 UTC [couchdb] handleRequest -> WARN 008 Retrying couchdb request in 1s. Attempt:4  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:14:56.438 UTC [couchdb] handleRequest -> WARN 009 Retrying couchdb request in 2s. Attempt:5  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:14:58.445 UTC [couchdb] handleRequest -> WARN 00a Retrying couchdb request in 4s. Attempt:6  Error:Get http://couchdb.peer0.org1.example.com:5984/: dial tcp 172.18.0.5:5984: connect: connection refused
2021-02-17 06:15:02.939 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 00b Created state database _users
2021-02-17 06:15:03.063 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 00c Created state database _replicator
2021-02-17 06:15:03.064 UTC [ledgermgmt] initialize -> INFO 00d ledger mgmt initialized
2021-02-17 06:15:03.064 UTC [peer] func1 -> INFO 00e Auto-detected peer address: 172.18.0.12:7051
2021-02-17 06:15:03.065 UTC [peer] func1 -> INFO 00f Returning peer0.org1.example.com:7051
2021-02-17 06:15:03.065 UTC [peer] func1 -> INFO 010 Auto-detected peer address: 172.18.0.12:7051
2021-02-17 06:15:03.065 UTC [peer] func1 -> INFO 011 Returning peer0.org1.example.com:7051
2021-02-17 06:15:03.096 UTC [nodeCmd] serve -> INFO 012 Starting peer with TLS enabled
2021-02-17 06:15:03.097 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 013 Entering computeChaincodeEndpoint with peerHostname: peer0.org1.example.com
2021-02-17 06:15:03.097 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 014 Exit with ccEndpoint: peer0.org1.example.com:7052
2021-02-17 06:15:03.099 UTC [sccapi] registerSysCC -> INFO 015 system chaincode lscc(github.com/hyperledger/fabric/core/scc/lscc) registered
2021-02-17 06:15:03.099 UTC [sccapi] registerSysCC -> INFO 016 system chaincode cscc(github.com/hyperledger/fabric/core/scc/cscc) registered
2021-02-17 06:15:03.099 UTC [sccapi] registerSysCC -> INFO 017 system chaincode qscc(github.com/hyperledger/fabric/core/scc/qscc) registered
2021-02-17 06:15:03.099 UTC [sccapi] registerSysCC -> INFO 018 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle,true) disabled
2021-02-17 06:15:03.101 UTC [gossip.service] func1 -> INFO 019 Initialize gossip with endpoint peer0.org1.example.com:7051 and bootstrap set [peer1.org1.example.com:8051]
2021-02-17 06:15:03.104 UTC [gossip.gossip] NewGossipService -> INFO 01a Creating gossip service with self membership of Endpoint: peer0.org1.example.com:7051, InternalEndpoint: peer0.org1.example.com:7051, PKI-ID: 452f291d782b4158adc9b146d53ebc80be2bb8240ba0ffe848d6e35208525834, Metadata: 
2021-02-17 06:15:03.104 UTC [gossip.gossip] start -> INFO 01b Gossip instance peer0.org1.example.com:7051 started
2021-02-17 06:15:03.105 UTC [sccapi] deploySysCC -> INFO 01c system chaincode lscc/(github.com/hyperledger/fabric/core/scc/lscc) deployed
2021-02-17 06:15:03.105 UTC [cscc] Init -> INFO 01d Init CSCC
2021-02-17 06:15:03.105 UTC [sccapi] deploySysCC -> INFO 01e system chaincode cscc/(github.com/hyperledger/fabric/core/scc/cscc) deployed
2021-02-17 06:15:03.106 UTC [qscc] Init -> INFO 01f Init QSCC
2021-02-17 06:15:03.106 UTC [sccapi] deploySysCC -> INFO 020 system chaincode qscc/(github.com/hyperledger/fabric/core/scc/qscc) deployed
2021-02-17 06:15:03.106 UTC [sccapi] deploySysCC -> INFO 021 system chaincode (+lifecycle,github.com/hyperledger/fabric/core/chaincode/lifecycle) disabled
2021-02-17 06:15:03.106 UTC [nodeCmd] serve -> INFO 022 Deployed system chaincodes
2021-02-17 06:15:03.107 UTC [discovery] NewService -> INFO 023 Created with config TLS: true, authCacheMaxSize: 1000, authCachePurgeRatio: 0.750000
2021-02-17 06:15:03.107 UTC [nodeCmd] registerDiscoveryService -> INFO 024 Discovery service activated
2021-02-17 06:15:03.107 UTC [nodeCmd] serve -> INFO 025 Starting peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051]
2021-02-17 06:15:03.108 UTC [nodeCmd] serve -> INFO 026 Started peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051]
2021-02-17 06:15:03.111 UTC [kvledger] LoadPreResetHeight -> INFO 027 Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2021-02-17 06:15:03.111 UTC [fsblkstorage] LoadPreResetHeight -> INFO 028 Loading Pre-reset heights
2021-02-17 06:15:03.111 UTC [fsblkstorage] preRestHtFiles -> INFO 029 Dir [/var/hyperledger/production/ledgersData/chains/chains] missing... exiting
2021-02-17 06:15:03.111 UTC [fsblkstorage] LoadPreResetHeight -> INFO 02a Pre-reset heights loaded
2021-02-17 06:15:03.112 UTC [nodeCmd] func7 -> INFO 02b Starting profiling server with listenAddress = 0.0.0.0:6060
2021-02-17 06:15:06.110 UTC [gossip.discovery] func1 -> WARN 02c Could not connect to Endpoint: peer1.org1.example.com:8051, InternalEndpoint: peer1.org1.example.com:8051, PKI-ID: <nil>, Metadata:  : context deadline exceeded
2021-02-17 06:15:13.171 UTC [core.comm] ServerHandshake -> ERRO 02d TLS handshake failed with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.18.0.1:35634
2021-02-17 06:15:14.183 UTC [core.comm] ServerHandshake -> ERRO 02e TLS handshake failed with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.18.0.1:35638
2021-02-17 06:15:15.551 UTC [core.comm] ServerHandshake -> ERRO 02f TLS handshake failed with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.18.0.1:35642
2021-02-17 06:15:34.112 UTC [gossip.discovery] func1 -> WARN 030 Could not connect to Endpoint: peer1.org1.example.com:8051, InternalEndpoint: peer1.org1.example.com:8051, PKI-ID: <nil>, Metadata:  : context deadline exceeded
2021-02-17 06:15:53.633 UTC [endorser] callChaincode -> INFO 031 [][de5a8ae1] Entry chaincode: name:"lscc" 
2021-02-17 06:15:53.634 UTC [endorser] callChaincode -> INFO 032 [][de5a8ae1] Exit chaincode: name:"lscc"  (1ms)
2021-02-17 06:15:53.634 UTC [comm.grpc.server] 1 -> INFO 033 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:35662 grpc.code=OK grpc.call_duration=1.926352ms
2021-02-17 06:16:02.129 UTC [gossip.discovery] func1 -> WARN 034 Could not connect to Endpoint: peer1.org1.example.com:8051, InternalEndpoint: peer1.org1.example.com:8051, PKI-ID: <nil>, Metadata:  : context deadline exceeded
2021-02-17 06:16:30.134 UTC [gossip.discovery] func1 -> WARN 035 Could not connect to Endpoint: peer1.org1.example.com:8051, InternalEndpoint: peer1.org1.example.com:8051, PKI-ID: <nil>, Metadata:  : context deadline exceeded
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0xd9fae7]

goroutine 319 [running]:
github.com/hyperledger/fabric/core/scc/lscc.(*LifeCycleSysCC).ChaincodeDefinition(0xc002104a50, 0xc002462ee0, 0xa, 0x0, 0x0, 0xc002104a00, 0xc002462ee0, 0xa, 0xc002420f00)
    /opt/gopath/src/github.com/hyperledger/fabric/core/scc/lscc/lscc.go:187 +0x37
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).GetChaincodeDefinition(0xc002160720, 0xc002462ee0, 0xa, 0x0, 0x0, 0xc0020c6e50, 0x2, 0x2, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:152 +0x64
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal(0xc00024c840, 0xc00241cd90, 0xc002474b40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:228 +0xd65
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal(0xc00024c840, 0x13d5b80, 0xc002435950, 0xc002474690, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:500 +0x3c9
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal(0xc00215f490, 0x13d5b80, 0xc002435950, 0xc002474690, 0x10c0c60, 0xc002435700, 0x7f70da61e2c8)
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61 +0x8f
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal(0xc00215f450, 0x13d5b80, 0xc002435950, 0xc002474690, 0xc00215f450, 0xc00237be00, 0xc002420d80)
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32 +0x51
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler.func1(0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0x0, 0xc00230d318, 0x42be22, 0xc000000008)
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:169 +0x86
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1(0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0x0, 0x18, 0xc000061500, 0xc000061500)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:31 +0x118
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor(0xc00022bb60, 0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0xc002492200, 0xc0024746e0, 0x0, 0x0, 0x0, ...)
    /opt/gopath/src/github.com/hyperledger/fabric/core/comm/throttle.go:54 +0xd3
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor-fm(0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0xc002492200, 0xc0024746e0, 0xc00246f260, 0xc0024359fe, 0x126db79, 0x16)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:228 +0x73
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1(0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0x0, 0x13d5bfe, 0xc002435950, 0x1020220)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34 +0x9f
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1(0x13d5b80, 0xc002435950, 0x11bcd60, 0xc002474690, 0xc002492200, 0xc0024746e0, 0xc0002ef980, 0x4a0076, 0x602cb4c2, 0x2fe8f619)
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpclogging/server.go:91 +0x256
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1(0x13d5b80, 0xc002435800, 0x11bcd60, 0xc002474690, 0x13c0540, 0x1ff3648, 0x11b8d60, 0xc002490101)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34 +0x9f
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1(0x13d5b80, 0xc002435800, 0x11bcd60, 0xc002474690, 0xc002492200, 0xc0024746e0, 0x10b2980, 0x1ff3648, 0xc0002efae8, 0x40d1d8)
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:30 +0x1d6
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1(0x13d5b80, 0xc002435800, 0x11bcd60, 0xc002474690, 0xc002492200, 0xc002492220, 0x10b2980, 0x1ff3648, 0x1226540, 0xc002374700)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:39 +0x153
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler(0x10c0c60, 0xc00215f450, 0x13d5b80, 0xc002435800, 0xc00241cbd0, 0xc0003b36b0, 0x0, 0x0, 0xc002374700, 0x50)
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:171 +0x158
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001a8480, 0x13dd600, 0xc002284c00, 0xc002374700, 0xc00227d680, 0x1ed38c0, 0xc0024357a0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:982 +0x4cd
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream(0xc0001a8480, 0x13dd600, 0xc002284c00, 0xc002374700, 0xc0024357a0)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1208 +0x1311
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0024627d0, 0xc0001a8480, 0x13dd600, 0xc002284c00, 0xc002374700)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:686 +0x9f
created by github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:684 +0xa1

docker-编写基础文件

version: '2'

services:

  orderer1.example.com:
    container_name: orderer1.example.com
    extends:
      file: peer-base.yaml
      service: orderer-base
    volumes:
        - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp:/var/hyperledger/orderer/msp
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/:/var/hyperledger/orderer/tls
        - orderer1.example.com:/var/hyperledger/production/orderer
    ports:
      - 7050:7050
  
  orderer2.example.com:
    container_name: orderer2.example.com
    extends:
      file: peer-base.yaml
      service: orderer-base
    volumes:
        - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls
        - orderer2.example.com:/var/hyperledger/production/orderer
    ports:
      - 8050:7050
  
  orderer3.example.com:
    container_name: orderer3.example.com
    extends:
      file: peer-base.yaml
      service: orderer-base
    volumes:
        - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp:/var/hyperledger/orderer/msp
        - ../crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/:/var/hyperledger/orderer/tls
        - orderer3.example.com:/var/hyperledger/production/orderer
    ports:
      - 9050:7050

  peer0.org1.example.com:
    container_name: peer0.org1.example.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer0.org1.example.com
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
    volumes:
        - /var/run/:/host/var/run/
        - ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
        - ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
        - peer0.org1.example.com:/var/hyperledger/production
    ports:
      - 7051:7051

  peer1.org1.example.com:
    container_name: peer1.org1.example.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer1.org1.example.com
      - CORE_PEER_ADDRESS=peer1.org1.example.com:8051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:8051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:8052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:8051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
    volumes:
        - /var/run/:/host/var/run/
        - ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
        - ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
        - peer1.org1.example.com:/var/hyperledger/production

    ports:
      - 8051:8051

  peer0.org2.example.com:
    container_name: peer0.org2.example.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer0.org2.example.com
      - CORE_PEER_ADDRESS=peer0.org2.example.com:9051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:9051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:10051
      - CORE_PEER_LOCALMSPID=Org2MSP
    volumes:
        - /var/run/:/host/var/run/
        - ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
        - ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
        - peer0.org2.example.com:/var/hyperledger/production
    ports:
      - 9051:9051

  peer1.org2.example.com:
    container_name: peer1.org2.example.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer1.org2.example.com
      - CORE_PEER_ADDRESS=peer1.org2.example.com:10051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:10051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:10052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:10051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051
      - CORE_PEER_LOCALMSPID=Org2MSP
    volumes:
        - /var/run/:/host/var/run/
        - ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
        - ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
        - peer1.org2.example.com:/var/hyperledger/production
    ports:
      - 10051:10051

如 Yacov 所说,您针对 v1.4.x 对等点的 v2.x 生命周期命令,因此预计会出现错误。当我在最新的 v1.4.10 peer 上尝试同样的事情时,我收到以下错误:

Error: query failed with status: 500 - make sure the chaincode _lifecycle has been successfully instantiated and try again: could not get definition for chaincode _lifecycle without a ledger context

这是有道理的,因为 v2.x 生命周期使用 _lifecycle 命名空间中的系统链码。它在 v1.4.x 对等体上不存在,因此您会收到错误消息。也许错误在 v1.4.3 中没有得到正确处理。无论如何,您都应该升级到 v1.4.10,因为自 v1.4.3 时间框架以来有许多重要修复。