HyperledgerHandsOn / trade-network

Hyperledger Hands-On second edition - Scripts to deploy the trade network
Apache License 2.0
38 stars 194 forks source link

Error in Mac Book Pro with M1 when deploying a contract #19

Closed gnurtcouq closed 2 years ago

gnurtcouq commented 2 years ago

Hi,

I install the trade network in my Mac Book Pro with M1. At Chapter 9, page 406 "Deploying a contract in one step", when I run the below command:

./trade.sh installcontract -c tradechannel -p trade -o 3

There is error in network-cli.log as:

... Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Failed to pull hyperledger/fabric-nodeenv:2.2: no matching manifest for linux/arm64/v8 in the manifest list entries !!!!!!!!!!!!!!! Failed to install chaincode on peer0.exporterorg.trade.com for channel 'tradechannel' !!!!!!!!!!!!!!!! ========= ERROR !!! FAILED to execute Chaincode Installation Scenario ===========

Any idea how to fix this?

Thx in advance,

Trung

VRamakrishna commented 2 years ago

It looks like Docker Hub may not have a hyperledger/fabric-nodeenv image for your OS and architecture. Can you try cloning Hyperledger Fabric (https://github.com/hyperledger/fabric) and building images from source (run make docker)? This is mentioned in the book, I believe in Chapter 4. The Docker images should be built and available on your system. Then go back to the instructions in the book to set up the network and start the apps.

gnurtcouq commented 2 years ago

Hi VRamakrishna,

After issue make docker in ../fabric folder, I still cannot see the image hyperledger/fabric-nodeenv . Below are the list of when I run "docker images" command:

REPOSITORY TAG IMAGE ID CREATED SIZE hyperledger/fabric-orderer 2.3 b5bca85605ba 4 days ago 33.4MB hyperledger/fabric-orderer 2.3.3 b5bca85605ba 4 days ago 33.4MB hyperledger/fabric-orderer arm64-2.3.3-snapshot-99553020d b5bca85605ba 4 days ago 33.4MB hyperledger/fabric-orderer latest b5bca85605ba 4 days ago 33.4MB hyperledger/fabric-baseos 2.3 6689daf2e6fa 4 days ago 6.67MB hyperledger/fabric-baseos 2.3.3 6689daf2e6fa 4 days ago 6.67MB hyperledger/fabric-baseos arm64-2.3.3-snapshot-99553020d 6689daf2e6fa 4 days ago 6.67MB hyperledger/fabric-baseos latest 6689daf2e6fa 4 days ago 6.67MB hyperledger/fabric-tools 2.3 3f1356f21455 8 weeks ago 872MB hyperledger/fabric-tools 2.3.3 3f1356f21455 8 weeks ago 872MB hyperledger/fabric-tools arm64-2.3.3-snapshot-99553020d 3f1356f21455 8 weeks ago 872MB hyperledger/fabric-tools latest 3f1356f21455 8 weeks ago 872MB hyperledger/fabric-peer 2.3 c76579345a25 8 weeks ago 775MB hyperledger/fabric-peer 2.3.3 c76579345a25 8 weeks ago 775MB hyperledger/fabric-peer arm64-2.3.3-snapshot-99553020d c76579345a25 8 weeks ago 775MB hyperledger/fabric-peer latest c76579345a25 8 weeks ago 775MB hyperledger/fabric-ccenv 2.3 b49770c153cb 2 months ago 496MB hyperledger/fabric-ccenv 2.3.3 b49770c153cb 2 months ago 496MB hyperledger/fabric-ccenv arm64-2.3.3-snapshot-99553020d b49770c153cb 2 months ago 496MB hyperledger/fabric-ccenv latest b49770c153cb 2 months ago 496MB

VRamakrishna commented 2 years ago

Ah.....the Fabric repository only contains build support for Golang chaincode containers (fabric-ccenv).

For fabric-nodeenv, I think you'll need to clone https://github.com/hyperledger/fabric-chaincode-node, cd to docker/fabric-nodeenv and build the image locally from the Dockerfile (I typically run docker build -t .). Try this and see if the image gets built.

gnurtcouq commented 2 years ago

Hi VRamakrishna,

What is exact command to build the image locally from the Dockerfile ?

E.g I cloned https://github.com/hyperledger/fabric-chaincode-node, then:

cd /Users/phamquoctrung/go/src/github.com/hyperledger/fabric-chaincode-node/docker/fabric-nodeenv ????

VRamakrishna commented 2 years ago

I mentioned it in my earlier comment: docker build -t .

gnurtcouq commented 2 years ago

Hi VRamakrishna,

There is error:

docker build -t . invalid argument "." for "-t, --tag" flag: invalid reference format See 'docker build --help'.

jdtProg commented 2 years ago

@gnurtcouq were you able to fix the problem?

There is error:

docker build -t . invalid argument "." for "-t, --tag" flag: invalid reference format See 'docker build --help'.

VRamakrishna commented 2 years ago

@gnurtcouq My mistake, -t was the wrong switch (that's for specifying the tag). For help on docker image building, see https://docs.docker.com/engine/reference/commandline/build/. I hope you were able to resolve your problem. Since this issue has been inactive for several months, I will close it. Please reopen it if you need to.