Skip to content

Instantly share code, notes, and snippets.

@indranil32
Created June 24, 2021 10:47
Show Gist options
  • Save indranil32/e9c284fb8f3d4bb45645c523c6058a58 to your computer and use it in GitHub Desktop.
Save indranil32/e9c284fb8f3d4bb45645c523c6058a58 to your computer and use it in GitHub Desktop.
Local clean up post test network down
#!/bin/bash
# MAKE SURE TO RUN THIS POST ./network.sh down
echo -e "Full clean...."
# remove exitied containers
docker rm -f $(docker ps -aq)
# remove pre-built chaincodes
rm -rf *.tar.gz
# remove previous channel blocks
rm -rf channel-artifacts/
# delete organizaions
rm -rf organizations/ordererOrganizations organizations/peerOrganizations
rm -rf organizations/fabric-ca/ordererOrg/msp organizations/fabric-ca/ordererOrg/Issuer* organizations/fabric-ca/ordererOrg/ca-cert.pem organizations/fabric-ca/ordererOrg/fabric-ca-server.db organizations/fabric-ca/ordererOrg/tls-cert.pem
rm -rf organizations/fabric-ca/org1/Issuer* organizations/fabric-ca/org1/ca-cert.pem organizations/fabric-ca/org1/fabric-ca-server.db organizations/fabric-ca/org1/tls-cert.pem organizations/fabric-ca/org1/msp
rm -rf organizations/fabric-ca/org2/Issuer* organizations/fabric-ca/org2/ca-cert.pem organizations/fabric-ca/org2/fabric-ca-server.db organizations/fabric-ca/org2/tls-cert.pem organizations/fabric-ca/org2/msp
rm -rf organizations/fabric-ca/org3/Issuer* organizations/fabric-ca/org3/ca-cert.pem organizations/fabric-ca/org3/fabric-ca-server.db organizations/fabric-ca/org3/tls-cert.pem organizations/fabric-ca/org3/msp
# docker prune
y|docker volume prune
y|docker network prune
y|docker container prune
echo -e "Cleanup done!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment