dockerblockchainhyperledger-fabric

Docker error while trying to install chaincode to a hyperledger fabric channel


I encounter the following problem while trying to install chaincode to a hyperledger fabric channel:

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 "unix.sock/images/dev-peer0.org1.thesis-network.com-th_1-40a3b76740e0628f827bc3a6eb13e6b36b1e1042cc19e5a6315f215627ef915d-599dd0d24e31b8859d9b1a4628fd9129002e6b0ed7795d83fc72916dc5e13075/json": dial unix /var/run/docker.sock: connect: no such file or directory

I am running my HLF network inside a docker container, it consists of 4 peer nodes, one orderer node and one cli node.

Docker Containers

I am trying to install the chaincode via the cli container with the following command: peer lifecycle chaincode (chaincode tar.gz file), after the command I get the docker error I posted earlier.

The environment variables regarding docker inside the docker-compose file for the cli container are: - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock, and this volume is mounted: - /var/run/:/host/var/run/

I tried changing the CORE_VM_ENDPOINT environment variable, prepackaging the chaincode on my machine before pulling up the docker network, did multiple resets of the network and tried it again, and also tried to change the CORE_VM_ENDPOINT from a Unix socket to a Docker TCP endpoint like the answer in this post suggested: create a Hyperledger Fabric network but nothing worked so far.

I should also specify that I dont really have a clue of HLF, and mainly followed this tutorial: https://medium.com/coinmonks/create-a-custom-network-and-deploy-your-own-chaincode-with-hyperledger-fabric-v2-1-6c689cf1b7cd

I am thankful for any help you could provide me with.


Solution

  • I think you probably need to just mount the docker.sock location directly rather than the containing directory. This was the case for me on MacOS anyway. For example:

    peer:
      environment:
        - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      volumes:
        - /var/run/docker.sock:/host/var/run/docker.sock