2017-10-05 23:21:54 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This script will remove all containers and hyperledger related images
|
|
|
|
|
|
|
|
# Detecting whether can import the header file to render colorful cli output
|
|
|
|
# Need add choice option
|
|
|
|
if [ -f ./header.sh ]; then
|
|
|
|
source ./header.sh
|
|
|
|
elif [ -f scripts/header.sh ]; then
|
|
|
|
source scripts/header.sh
|
|
|
|
else
|
2017-12-15 12:05:12 +08:00
|
|
|
echo_r() {
|
|
|
|
echo "$@"
|
|
|
|
}
|
|
|
|
echo_g() {
|
|
|
|
echo "$@"
|
|
|
|
}
|
|
|
|
echo_b() {
|
|
|
|
echo "$@"
|
|
|
|
}
|
2017-10-05 23:21:54 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo_b "Clean up all containers..."
|
|
|
|
docker rm -f `docker ps -qa`
|
|
|
|
|
2017-10-06 14:47:32 +08:00
|
|
|
echo_b "Clean up all chaincode images..."
|
|
|
|
docker rmi -f $(docker images |grep 'dev-peer'|awk '{print $3}')
|
2017-10-05 23:21:54 +08:00
|
|
|
|
|
|
|
echo_b "Clean up all hyperledger related images..."
|
2017-10-06 14:47:32 +08:00
|
|
|
docker rmi -f $(docker images |grep 'hyperledger'|awk '{print $3}')
|
|
|
|
|
|
|
|
echo_b "Clean up dangling images..."
|
|
|
|
docker rmi $(docker images -q -f dangling=true)
|
2017-10-05 23:21:54 +08:00
|
|
|
|
|
|
|
echo_g "Env cleanup done!"
|