Reputation: 1
I am trying to setup Hyperledger Fabric (v2.2.7) in Mac M1 Pro and using Docker Desktop v4.32.0. I was setting two organisation network. I was able to setup Peers, CA, Orderers in both Organisations and all docker containers running properly. But When I install the chain code, I am getting below error.
Here is the error message
bash-3.2$ peer lifecycle chaincode install snb-chaincode-chitgroup-act.tar.gz
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/prod-peer1.regulatororg.snbchain.com-snb-chaincode-chitgroup-act_1-e57cbc6399c641f23b9fc09c8777213886c981ee483d545f47c89d1ce7662d9 n-38a9c951ca5cfece43263dd8043dc218f2cb9171cf38610474815d5bb595176/json": dial unix /host/var/run/docker.sock: connect: no such file or directory
I have enabled "Allow the default Docker socket to be used (requires password)" option in docker settings and I checked /var/run/docker.sock is created.
bash-3.2$ ls -ltr /var/run/docker.sock
lrwxr-xr-x 1 root daemon 44 Jul 20 18:09 /var/run/docker.sock -> /Users/sridharreddyu/.docker/run/docker.sock
bash-3.2$
In peer docker compose files, I have this environment variable and volume mapping.
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
volumes:
- /var/run/:/host/var/run/
and I checked the docker container
/opt/gopath/src/github.com/hyperledger/fabric/peer # ls -ltr /host/var/run/docker.sock
lrwxr-xr-x 1 root root 44 Jul 20 12:39 /host/var/run/docker.sock -\> /Users/sridharreddyu/.docker/run/docker.sock
Here is the One of the Organisations Peer and Orderrer Network
bash-3.2$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
999ebc7558fd hyperledger/fabric-peer:2.2.7 "peer node start" 47 hours ago Up 47 hours 7051/tcp, 0.0.0.0:8051-\>8051/tcp peer2.regulatororg.snbchain.com
3300f05a7636 hyperledger/fabric-peer:2.2.7 "peer node start" 47 hours ago Up 47 hours 0.0.0.0:7051-\>7051/tcp, 0.0.0.0:17051-\>17051/tcp peer1.regulatororg.snbchain.com
2861dc96eba8 couchdb:3.1.1 "tini -- /docker-ent…" 47 hours ago Up 47 hours 4369/tcp, 9100/tcp, 0.0.0.0:6984-\>5984/tcp couchdb2.regulatororg
d5e2d4fefd77 hyperledger/fabric-ca:1.5.3 "sh -c 'fabric-ca-se…" 47 hours ago Up 47 hours 0.0.0.0:7054-\>7054/tcp ca_peerRegulatorOrg
ba1374fad5c4 couchdb:3.1.1 "tini -- /docker-ent…" 47 hours ago Up 47 hours 4369/tcp, 9100/tcp, 0.0.0.0:5984-\>5984/tcp couchdb1.regulatororg
bash-3.2$
Initially /var/run/docker.sock was not enabled when Docker installed, later after going through StackOverFlow, I enabled that option, still I am facing the issue.
I think root case of the issue is, the softlink created b/w /var/run/docker.sock to /Users/sridharreddyu/.docker/run/docker.sock When I checked in the container /host/var/run/docker.sock pointing to my home directory. I think container is not able to access my home directory from docker container.
Upvotes: 0
Views: 70
Reputation: 1649
I think you probably need to just map the docker.sock location correctly rather than mapping the containing directory. This approach works for me on an M1 Mac. For example, with DOCKER_SOCK
set appropriately:
peer:
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
volumes:
- ${DOCKER_SOCK}:/host/var/run/docker.sock
Upvotes: 0