Add filtering function to the dkcl function

The original dkcl function deletes all containers regardless of whether they were started by this sample or not (e.g. rancher/agent).
Doing so would corrupt the host's environment and cause inconvenience. So I added conditional filtering to the dkfc function.
This commit is contained in:
hag3 2018-12-11 10:46:38 +08:00 committed by GitHub
parent 53ae435304
commit dccd41ec13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@
#
function dkcl(){
CONTAINER_IDS=$(docker ps -aq)
CONTAINER_IDS=$(docker ps -a | grep "ca_peerOrg\|.example.com" | awk '{print $1}')
echo
if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then
echo "========== No containers available for deletion =========="