diff --git a/lib/functions.sh b/lib/functions.sh index 8224b7d..77b48e1 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -377,12 +377,21 @@ start_service() { fi fi + # On first startup, the containers are being downloaded -- this may fail + # with timeouts, so allow trying again + local TRIES=0 if [ $DEBUG ]; then # Start /federated/apps/SERVICE with output to console for debug - docker compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up + while [ "$TRIES" -lt 10 ]; do + docker compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up && break + TRIES=$((TRIES+1)) + done [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/$SERVICE" else - docker compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null + while [ "$TRIES" -lt 10 ]; do + docker compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null && break + TRIES=$((TRIES+1)) + done # Keep trying service port to make sure it's up before # we proceed