From 395c31b52913d3b98a36395a1cd488b1f9dc4dc5 Mon Sep 17 00:00:00 2001 From: troplolBE Date: Sat, 25 Jan 2020 19:16:00 +0100 Subject: [PATCH] fix remove script error --- docker/helk_remove_containers.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/helk_remove_containers.sh b/docker/helk_remove_containers.sh index 450f331..e3daacf 100755 --- a/docker/helk_remove_containers.sh +++ b/docker/helk_remove_containers.sh @@ -115,7 +115,9 @@ fi echo -e "${CYAN}${HELK_INFO_TAG}${STD} Removing all images..." # HELK Images #docker rmi "$(docker images -a | awk '{ print $1,$3 }' | grep 'otrf\|cyb3rward0g\|helk' | awk '{ print $2 }')" >> $LOGFILE 2>&1 -docker rmi "$(docker images -a | awk '{ print $1,$3 }' | grep 'otrf\|cyb3rward0g\|helk\|logstash\|kibana\|elasticsearch\|cp-ksql' | awk '{ print $2 }')" >> $LOGFILE 2>&1 +if [ "$(docker images -a | grep 'otrf\|cyb3rward0g\|helk\|logstash\|kibana\|elasticsearch\|cp-ksql' > /dev/null; echo $?)" == 0 ]; then + docker rmi "$(docker images -a | awk '{ print $1,$3 }' | grep 'otrf\|cyb3rward0g\|helk\|logstash\|kibana\|elasticsearch\|cp-ksql' | awk '{ print $2 }')" >> $LOGFILE 2>&1 +fi #TODO: these get removed in docker compose remove, but at some point may be good to implement this.. either: 1) create custom HELK ELK and KSQL images and this won't be an issue/thing or.. 2) figure out how to give option even though using compose.. However, this is really low hanging fruit, not worried about it for now 2019-01-25 # ELastic/Confluent Images, so give user option to remove them...as the user may be using those for other things on their system #echo -e "${CYAN}${HELK_INFO_TAG}${STD} You may be using the official, upstream, Elastic (ELK) and Confluent(KSQL) docker images for other components on your machine..."