Merge pull request #305 from danielino/master

fix count total_containers for swarm mode
This commit is contained in:
Thomas Sjögren 2018-05-18 12:58:00 +02:00 committed by GitHub
commit b926f0446a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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