From 680ff01a5dc7ec9ea4ed3ef0efb9b74da5bb8113 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 22 Mar 2018 11:24:47 +0800 Subject: [PATCH] [FAB-8600]Clear hyperledger-related containers only Change-Id: If45759c6db4b6e63aaadd1c86d31f1332a5aee53 Signed-off-by: alex --- first-network/byfn.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/first-network/byfn.sh b/first-network/byfn.sh index 0e68afc46d..a10e0a361e 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -87,7 +87,7 @@ function askProceed () { # Obtain CONTAINER_IDS and remove them # TODO Might want to make this optional - could clear other containers function clearContainers () { - CONTAINER_IDS=$(docker ps -aq) + CONTAINER_IDS=$(docker ps -a |awk '($2 ~ /dev-peer.*.mycc.*/) {print $1}') if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" == " " ]; then echo "---- No containers available for deletion ----" else @@ -99,7 +99,7 @@ function clearContainers () { # specifically the following images are often left behind: # TODO list generated image naming patterns function removeUnwantedImages() { - DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}') + DOCKER_IMAGE_IDS=$(docker images|awk '($1 ~ /dev-peer.*.mycc.*/) {print $3}') if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" == " " ]; then echo "---- No images available for deletion ----" else