diff --git a/tests/6_docker_security_operations.sh b/tests/6_docker_security_operations.sh index 3165986..28d6916 100644 --- a/tests/6_docker_security_operations.sh +++ b/tests/6_docker_security_operations.sh @@ -40,7 +40,7 @@ images=$(docker images -q | wc -l | awk '{print $1}') active_images=0 for c in $(docker inspect -f "{{.Image}}" $(docker ps -qa)); do - if docker images --no-trunc -a | grep $c > /dev/null ; then + if docker images --no-trunc -a | grep "$c" > /dev/null ; then active_images=$(( active_images += 1 )) fi done @@ -61,7 +61,7 @@ fi check_6_7="6.7 - Avoid container sprawl" 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))" +diff="$((total_containers - running_containers))" if [ "$diff" -gt 25 ]; then warn "$check_6_7" warn " * There are currently a total of $total_containers containers, with only $running_containers of them currently running"