Skip to content
Snippets Groups Projects
Commit 652c3a58 authored by adecoa's avatar adecoa Committed by Mark Beierl
Browse files

Execute docker health commands with docker group


Fixes bug #1205

Change-Id: Iccf15a31c4925421820e25d7c0821e322955267a
Signed-off-by: default avatarendika <endika.aldecoa@ehu.eus>
(cherry picked from commit ae9807e2)
parent 9dee2a67
No related branches found
Tags v3.0.0rc4
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment