From: endika Date: Fri, 11 Sep 2020 13:19:52 +0000 (+0200) Subject: Execute docker health commands with docker group X-Git-Tag: release-v9.0-start~65 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=ae9807e262603fb9753f22a215c085605258953c;p=osm%2Fdevops.git Execute docker health commands with docker group Fixes bug #1205 Change-Id: Iccf15a31c4925421820e25d7c0821e322955267a Signed-off-by: endika --- diff --git a/installers/osm_health.sh b/installers/osm_health.sh index 0f7922a3..e7c8065e 100755 --- a/installers/osm_health.sh +++ b/installers/osm_health.sh @@ -54,7 +54,7 @@ while [ $time -le "$WAIT_TIME" ]; do exit 0 fi else - if [ "$(docker ps | grep " ${STACK_NAME}_" | grep -i healthy | wc -l)" -ge "$NUM_SERVICES_WITH_HEALTH" ]; then + if [ "$(sg docker -c "docker ps" | grep " ${STACK_NAME}_" | grep -i healthy | wc -l)" -ge "$NUM_SERVICES_WITH_HEALTH" ]; then # all dockers are healthy now. # final sleep is needed until more health checks are added to validate system is ready to handle requests sleep $WAIT_FINAL @@ -79,12 +79,12 @@ if [ -n "$KUBERNETES" ]; then done else echo "Not all Docker services are healthy" - docker ps | grep " ${STACK_NAME}_" + sg docker -c "docker ps" | grep " ${STACK_NAME}_" for S_WITH_HEALTH in $SERVICES_WITH_HEALTH ; do - docker ps | grep " ${STACK_NAME}_" | grep -i healthy | grep -q "_${S_WITH_HEALTH}." && continue + sg docker -c "docker ps" | grep " ${STACK_NAME}_" | grep -i healthy | grep -q "_${S_WITH_HEALTH}." && continue echo echo BEGIN LOGS of container ${S_WITH_HEALTH} not healthy - docker service logs ${STACK_NAME}_${S_WITH_HEALTH} 2>&1 | tail -n 100 + sg docker -c "docker service logs ${STACK_NAME}_${S_WITH_HEALTH} 2>&1" | tail -n 100 echo END LOGS of container ${S_WITH_HEALTH} not healthy echo done