hyperledger fabric - How to remove a chaincode on peer?

To remove a chaincode on a peer you need to:

  • Kill the container that corresponds to the chaincode shim since a chaincode runs inside a docker container.

  • Delete the chaincode from the file system of the peer under /var/hyperledger/production/chaincodes


1) You can upgrade your chaincode and hit request to new chaincode.

adding to @yacovm 's answer -

2) You also need to delete docker image of the chaincode created :

docker images

docker rmi $(docker images chaincode_name -q)

If you want to remove multiple images as once ( assuming your chaincode image name starts with "cc_") try :

docker rmi $(docker images cc_* -q)