peer node unable to create chaincode container - dial unix /host/var/run/docker.sock: connect: permission denied error
peer node unable to create chaincode container - dial unix /host/var/run/docker.sock: connect: permission denied error
I am trying to setup hyperledger network on centos
Using 1.1.0 images from ibmblockchain docker hub.
I am able to start up the network without any issues. that is 1 orderer, 3 kafkas, 3 zookeepers and 2 peers.
But every time i try to instantiate chaincode, I see the below error in the peer docker containers. Can anyone help me with this issue.
2018-07-19 19:05:30.570 UTC [dockercontroller] Start -> ERRO 3ac start-could not recreate container , because of Post http://unix.sock/containers/create?name=dev-peer1.bns-250A-v1.0.2-b3: dial unix /host/var/run/docker.sock: connect: permission denied
2018-07-19 19:05:30.570 UTC [container] unlockContainer -> DEBU 3ad container lock deleted(dev-peer1.bns-250A-v1.0.2-b3)
2018-07-19 19:05:30.570 UTC [chaincode] launchAndWaitForRegister -> DEBU 3ae stopping due to error while launching: Post http://unix.sock/containers/create?name=dev-peer1-chaincode1-v1.0.2-b3: dial unix /host/var/run/docker.sock: connect: permission denied
error starting container.
Thank you.
2 Answers
2
the problem is a permission issue with /var/run/docker.sock
Check your /var/run/docker.sock permission
ls -l /var/run/docker.sock will let u know if you have the correct permission
sudo chmod 666 /var/run/socker.sock should give it correct rw access
I was able to fix this by adding Username, UserID and GroupID permissions to the docker run command.
Ex:
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: ibmblockchain/fabric-peer-$ARCH:1.1.0
environment:
- CORE_LOGGING_LEVEL=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=composer_default
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/msp
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
- USERNAME=(your userid)
- USER_ID=1000
- GROUP_ID=999
This is mentioned as the solution in ibmblockchain github repo :
https://github.com/IBM-Blockchain/ibm-blockchain-issues/issues/125
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.