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