Search code examples
dockerhyperledger-fabrichyperledger-chaincode

Chaincode container getting created but not starting


Hyperledger-Fabric: v2.3.3

Peer docker image: tag 2.3.3

Error on peer logs after committing chaincode:

ERRO 036 start-could not start container: API error (400): failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "chaincode": executable file not found in $PATH: unknown

WARN 037 could not launch chaincode 'test_v1_v1:65f5b95ca7ff438e02a86aea4205bcd697a2afa0f4e37c314d3011667357fe50': error starting container: error starting container: API error (400): failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "chaincode": executable file not found in $PATH: unknown

  • docker ps -a shows that chaincode container status: Created.
  • I tried restarting peers and orderer, but same error

*Note: Comment if I should provide any specific configuration or anything to understand the problem.


Solution

  • The problem was that the package name in chaincode file was not "main" (I thought that we have to name it as parent directory).

    So, the binary was not getting generated after the chaincode was committed. As a result when the peer was trying to launch/run chaincode container it was saying that I don't have binary/executable file to run.

    After changing package name to "main" and doing packaging, installation and commit process the chaincode container started.


    *NOTE: This is my understanding of the problem, please let me know if anything written above is misconception/ wrong.