diff options
author | Michael Boelen <michael@cisofy.com> | 2015-08-20 19:48:32 +0300 |
---|---|---|
committer | Michael Boelen <michael@cisofy.com> | 2015-08-20 19:48:32 +0300 |
commit | afe30cf3a739f871d2685c2b6fb78b1f74ad9cc8 (patch) | |
tree | 5dd57e9fc4aab1c7eba043963baea303440d0197 /include/tests_containers | |
parent | 210ba41a3c2c43041fa4ba40e9e0b0676052a2b8 (diff) | |
parent | 25c8567b572f44b2e86a99a084714c115252a830 (diff) |
Merge pull request #56 from mpepping/master
Comparison error when Docker is present, but the daemon is not running (or unset).
Diffstat (limited to 'include/tests_containers')
-rw-r--r-- | include/tests_containers | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/tests_containers b/include/tests_containers index dcd4d238..ce350aee 100644 --- a/include/tests_containers +++ b/include/tests_containers @@ -119,6 +119,9 @@ # Check total of containers logtext "Test: checking total amount of Docker containers" DOCKER_CONTAINERS_TOTAL=`${DOCKERBINARY} info 2> /dev/null | grep "^Containers: " | awk '{ print $2 }'` + if [ ${DOCKER_CONTAINERS_TOTAL} -z ]; then + DOCKER_CONTAINERS_TOTAL=0 + fi logtext "Result: docker info shows ${DOCKER_CONTAINERS_TOTAL} containers" DOCKER_CONTAINERS_TOTAL2=`${DOCKERBINARY} ps -a 2> /dev/null | grep -v "CONTAINER" | wc -l` logtext "Result: docker ps -a shows ${DOCKER_CONTAINERS_TOTAL2} containers" @@ -131,7 +134,7 @@ fi # Check running instances - DOCKER_CONTAINERS_RUNNING=`${DOCKERBINARY} ps | grep -v "CONTAINER" | wc -l` + DOCKER_CONTAINERS_RUNNING=`${DOCKERBINARY} ps 2> /dev/null | grep -v "CONTAINER" | wc -l` Display --indent 8 --text "- Running containers" --result "${DOCKER_CONTAINERS_RUNNING}" --color GREEN if [ ${DOCKER_CONTAINERS_RUNNING} -gt 0 ]; then logtext "Result: ${DOCKER_CONTAINERS_RUNNING} containers are currently active" |