diff --git a/tests/4_container_images.sh b/tests/4_container_images.sh index 3c7dec3..b319a5f 100644 --- a/tests/4_container_images.sh +++ b/tests/4_container_images.sh @@ -52,13 +52,13 @@ fi check_4_6="4.6 - Add HEALTHCHECK instruction to the container image" fail=0 for img in $images; do - docker inspect --format='{{.Config.Healthcheck}}' $img 2>/dev/null | grep -e "" >/dev/null 2>&1 + docker inspect --format='{{.Config.Healthcheck}}' "$img" 2>/dev/null | grep -e "" >/dev/null 2>&1 if [ $? -eq 0 ]; then if [ $fail -eq 0 ]; then fail=1 warn "$check_4_6" fi - imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null` + imgName=$(docker inspect --format='{{.RepoTags}}' "$img" 2>/dev/null) warn " * No Healthcheck found : $imgName" fi done @@ -70,13 +70,13 @@ fi check_4_7="4.7 - Do not use update instructions alone in the Dockerfile" fail=0 for img in $images; do - docker history $img 2>/dev/null | grep -e "update" >/dev/null 2>&1 + docker history "$img" 2>/dev/null | grep -e "update" >/dev/null 2>&1 if [ $? -eq 0 ]; then if [ $fail -eq 0 ]; then fail=1 info "$check_4_7" fi - imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null` + imgName=$(docker inspect --format='{{.RepoTags}}' "$img" 2>/dev/null) info " * Update instruction found in history of $imgName" fi done @@ -88,13 +88,13 @@ fi check_4_9="4.9 - Use COPY instead of ADD in Dockerfile" fail=0 for img in $images; do - docker history $img 2> /dev/null | grep 'ADD' >/dev/null 2>&1 + docker history "$img" 2> /dev/null | grep 'ADD' >/dev/null 2>&1 if [ $? -eq 0 ]; then if [ $fail -eq 0 ]; then fail=1 info "$check_4_9" fi - imgName=`docker inspect --format='{{.RepoTags}}' $img 2>/dev/null` + imgName=$(docker inspect --format='{{.RepoTags}}' "$img" 2>/dev/null) info " * Found ADD in docker history of $imgName" fi done diff --git a/tests/5_container_runtime.sh b/tests/5_container_runtime.sh index dd984e9..6ff1557 100644 --- a/tests/5_container_runtime.sh +++ b/tests/5_container_runtime.sh @@ -591,7 +591,7 @@ else fail=0 for c in $containers; do - pidslimit=`docker inspect --format '{{.HostConfig.PidsLimit }}' "$c"` + pidslimit=$(docker inspect --format '{{.HostConfig.PidsLimit }}' "$c") if [ $pidslimit -le 0 ]; then # If it's the first container, fail the test @@ -613,12 +613,12 @@ else check_5_29="5.29 - Do not use Docker's default bridge docker0" fail=0 - networks=`docker network ls -q 2>/dev/null` + networks=$(docker network ls -q 2>/dev/null) for net in $networks; do docker network inspect --format '{{ .Options }}' "$net" 2>/dev/null | grep "com.docker.network.bridge.name:docker0" >/dev/null 2>&1 if [ $? -eq 0 ]; then - docker0Containers=`docker network inspect --format='{{ range $k, $v := .Containers }} {{ $k }} {{ end }}' "$net" 2>/dev/null` + docker0Containers=$(docker network inspect --format='{{ range $k, $v := .Containers }} {{ $k }} {{ end }}' "$net" 2>/dev/null) if [ -n "$docker0Containers" ]; then if [ $fail -eq 0 ]; then warn "$check_5_29"