fix count total_containers for swarm mode

Signed-off-by: Daniele Marcocci <daniele.marcocci@par-tec.it>
This commit is contained in:
Daniele Marcocci 2018-05-18 10:17:42 +02:00
parent f7518b4d7a
commit 77074962b1

View file

@ -32,7 +32,7 @@ check_6_1() {
check_6_2() { check_6_2() {
check_6_2="6.2 - Avoid container sprawl" check_6_2="6.2 - Avoid container sprawl"
totalChecks=$((totalChecks + 1)) 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}') running_containers=$(docker ps -q | wc -l | awk '{print $1}')
diff="$((total_containers - running_containers))" diff="$((total_containers - running_containers))"
if [ "$diff" -gt 25 ]; then if [ "$diff" -gt 25 ]; then