简体   繁体   中英

How to start and register a chaincode of Hyperledger on Windows10

I am trying to start a chaincode on Windows10 operating system. According to the document, after running docker-compose -f single-peer-ca.yaml up , a command like this

CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02

will start the chaincode and a message “Received REGISTERED, ready for invocations” will be reveived. On my linux environment, everything goes well, but on my Windows, when I input the command above into Powershell,

CORE_CHAINCODE_ID_NAME=mycc : The term 'CORE_CHAINCODE_ID_NAME=mycc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincod ...

+~~~~~~~~~~~~~~~~~~~~~~~~~~~

+CategoryInfo : ObjectNotFound: (CORE_CHAINCODE_ID_NAME=mycc:String)[], CommandNotFoundException

+FullyQualifiedErrorId : CommandNotFoundException

Obviously, Powershell doesn't recognize the command directly as terminal of linux. So, what command should I run ?

I have tried

docker run --name=node_vp0 -e CORE_CHAINCODE_IF_NAME=mycc -e CORE_PEER_ADDRESS=0.0.0.0:7051 .\chaincode_example02

But Powershell gave me

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error parsing reference: ".\\chaincode_example02" is not a valid repository/tag: invalid reference format.

To register a chaincode on Windows 10 (in docker container), you need to be in the container

For this, open a command prompt and go to bash shell using docker command :

docker exec -it [peer-container-name] /bin/bash

This will enable you to use linux commands and register chaincode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM