From d2963b4c423eb2b8916a4b5e77dc66ecfb9917aa Mon Sep 17 00:00:00 2001 From: jammasterj89 Date: Wed, 4 Dec 2019 11:14:43 +0000 Subject: [PATCH] Reorder of sed command on images Ensure sed command is first when filtering on images to ensure the description row is removed correctly. Signed-off-by: Niall T --- docker-bench-security.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index c925d75..8d9a602 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -114,11 +114,11 @@ main () { if [ -n "$include" ]; then pattern=$(echo "$include" | sed 's/,/|/g') containers=$(docker ps | sed '1d' | awk '{print $NF}' | grep -v "$benchcont" | grep -E "$pattern") - images=$(docker images | grep -E "$pattern" | sed '1d' | awk '{print $3}' | grep -v "$benchimagecont") + images=$(docker images | sed '1d' | grep -E "$pattern" | awk '{print $3}' | grep -v "$benchimagecont") elif [ -n "$exclude" ]; then pattern=$(echo "$exclude" | sed 's/,/|/g') containers=$(docker ps | sed '1d' | awk '{print $NF}' | grep -v "$benchcont" | grep -Ev "$pattern") - images=$(docker images | grep -Ev "$pattern" | sed '1d' | awk '{print $3}' | grep -v "$benchimagecont") + images=$(docker images | sed '1d' | grep -Ev "$pattern" | awk '{print $3}' | grep -v "$benchimagecont") else containers=$(docker ps | sed '1d' | awk '{print $NF}' | grep -v "$benchcont") images=$(docker images -q | grep -v "$benchcont")