mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-19 00:32:34 +01:00
commit
88566a8f9f
1 changed files with 2 additions and 2 deletions
|
@ -40,7 +40,7 @@ images=$(docker images -q | wc -l | awk '{print $1}')
|
||||||
active_images=0
|
active_images=0
|
||||||
|
|
||||||
for c in $(docker inspect -f "{{.Image}}" $(docker ps -qa)); do
|
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 ))
|
active_images=$(( active_images += 1 ))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -61,7 +61,7 @@ fi
|
||||||
check_6_7="6.7 - Avoid container sprawl"
|
check_6_7="6.7 - Avoid container sprawl"
|
||||||
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
|
||||||
warn "$check_6_7"
|
warn "$check_6_7"
|
||||||
warn " * There are currently a total of $total_containers containers, with only $running_containers of them currently running"
|
warn " * There are currently a total of $total_containers containers, with only $running_containers of them currently running"
|
||||||
|
|
Loading…
Reference in a new issue