Add filtering function to the dkcl function (DCO)

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.
Signed-off-by: Hag hag3@21cn.com
This commit is contained in:
hag3 2018-12-11 12:18:07 +08:00 committed by GitHub
parent dccd41ec13
commit c3586bcf02
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 -a | grep "ca_peerOrg\|.example.com" | awk '{print $1}')
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 =========="