How to remove old chaincode containers and chaincode images in Azure Hyperledger Fabric?

Anurag, Anurag (External) 51 Reputation points
2020-09-16T17:48:32.707+00:00

Hi,
I am using Azure Hyperledger Fabric. I have 3 peer organizations in my blockchain network. I upgrade the chaincode multiple times. Also I install new chaincode on certain occasions. Hence, I want to remove/delete the old chaincode containers as I no longer need them.

How can this be done?

Thanks.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,166 questions
0 comments No comments
{count} votes

Accepted answer
  1. AshokPeddakotla-MSFT 27,646 Reputation points
    2020-09-17T02:29:59.687+00:00

    @Anurag, Anurag (External)

    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

    You can also delete docker image of the chain code created using the below command.

    Note: You need to SSH into the AKS nodes to run the commands. For instructions, please check SSH to Azure Kubernetes Service (AKS) cluster nodes

    docker images  
    docker rmi $(docker images chaincode_name -q)  
    

    Reference: SO

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful