我在通道(超时)上实例化我的链码时遇到问题,由于我对Docker和容器化还很陌生,它可能来自网络设置。
以下是命令:
docker exec -e "CORE_PEER_LOCALMSPID=ControlTowerMSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@controltower.com/msp" peer0.controltower.com peer chaincode instantiate -C frenchspoonchannel -n nodecc -v 1.0 -c '{"Args":["init","a","100","b","200"]}'
链码容器已创建但未启动,并且命令超时
对等日志:
2018-12-05 13:46:20.263 UTC [endorser] SimulateProposal -> ERRO 036 [frenchspoonchannel][b33ded8e] failed to invoke chaincode name:"lscc" , error: timeout expired while starting chaincode nodecc:1.0 for transaction b33ded8e61c100521c4e08ab9402b5324cb967f63e1163d1963e2293ce0445f6
dev-peer日志:
Error: Cannot find module '/usr/local/src/chaincode_example02.js'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chaincode_example02@1.0.0 start: `node chaincode_example02.js "-- peer.address" "192.168.176.5:7052"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chaincode_example02@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Orderer&Peer docker-compose.yaml
orderer.com:
container_name: orderer.com
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=info
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderer
command: orderer
ports:
- 7050:7050
volumes:
- ./config/:/etc/hyperledger/configtx
- ./crypto-config/ordererOrganizations/controltower.com/orderers/orderer.controltower.com/:/etc/hyperledger/msp/orderer
- ./crypto-config/peerOrganizations/controltower.com/peers/devpeer/:/etc/hyperledger/msp/peer0.controlTower.com
networks:
- controltower.com
peer0.controltower.com:
container_name: peer0.controltower.com
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.controltower.com
- CORE_LOGGING_PEER=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_LOCALMSPID=ControlTowerMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.controltower.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=p0.controltower.co:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=p0.controltower.co:7051
#- CORE_PEER_CHAINCODELISTENADDRESS=peer0.controltower.com:7052
# # 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}_controltower.com
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
# command: peer node start --peer-chaincodedev=true
ports:
- 7051:7051
#- 7052:7052
- 7053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/controltower.com/peers/devpeer/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/controltower.com/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
- ./chaincode:/etc/hyperledger/chaincode
depends_on:
- orderer.com
- couchdb
networks:
- controltower.com
如您所见,我尝试使用env var chaincode.listen.address并打开了新端口7052,但是它不起作用。
谢谢!