From 77074962b1dd4c3a0f78c5ae1135dc23f11b0dd7 Mon Sep 17 00:00:00 2001 From: Daniele Marcocci Date: Fri, 18 May 2018 10:17:42 +0200 Subject: [PATCH] fix count total_containers for swarm mode Signed-off-by: Daniele Marcocci --- tests/6_docker_security_operations.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/6_docker_security_operations.sh b/tests/6_docker_security_operations.sh index 8376e09..b76959e 100644 --- a/tests/6_docker_security_operations.sh +++ b/tests/6_docker_security_operations.sh @@ -32,7 +32,7 @@ check_6_1() { check_6_2() { check_6_2="6.2 - Avoid container sprawl" totalChecks=$((totalChecks + 1)) - total_containers=$(docker info 2>/dev/null | grep "Containers" | awk '{print $2}') + total_containers=$(docker info 2>/dev/null | grep "^Containers" | awk '{print $2}') running_containers=$(docker ps -q | wc -l | awk '{print $1}') diff="$((total_containers - running_containers))" if [ "$diff" -gt 25 ]; then