-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait for docker server to be available after starting it
- Loading branch information
1 parent
9334d70
commit 47e1a78
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
docker network inspect backend | ||
|
||
url="http://localhost:8420" | ||
timeout_in_seconds=3600 # 60 minutes in seconds | ||
|
||
start_time=$(date +%s) | ||
|
||
while true; do | ||
response_code=$(curl -s -o /dev/null -w "%{http_code}" "$url") | ||
|
||
if [ "$response_code" -eq 200 ]; then | ||
echo "Success! Received 200 OK response." | ||
break | ||
else | ||
echo "Failed, got $response_code as response code. Retrying..." | ||
sleep 5 | ||
|
||
current_time=$(date +%s) | ||
elapsed_time=$((current_time - start_time)) | ||
|
||
if [ "$elapsed_time" -ge "$timeout_in_seconds" ]; then | ||
echo "Timeout reached. Exiting." | ||
exit 1 | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters