File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Container name must be consistent with the name defined in the docker-compose.yaml
4
+ CONTAINER_NAME=" localstack-ts-api-gateway-lambda-dynamodb-crud"
5
+ TIMEOUT=30 # Maximum wait time in seconds
6
+ INTERVAL=2 # Interval between checks in seconds
7
+
8
+ # Loop to check the health status of the container
9
+ for (( i= 0 ; i< $TIMEOUT ; i+= $INTERVAL )) ; do
10
+ # Check if the container is healthy
11
+ if [ " $( docker inspect -f ' {{.State.Health.Status}}' $CONTAINER_NAME 2> /dev/null) " == " healthy" ]; then
12
+ echo " $CONTAINER_NAME is ready."
13
+ exit 0
14
+ fi
15
+ echo " Waiting for $CONTAINER_NAME to be ready..."
16
+ sleep $INTERVAL # Wait for the specified interval before checking again
17
+ done
18
+
19
+ echo " $CONTAINER_NAME is not ready after $TIMEOUT seconds."
20
+ exit 1 # Exit with a failure status
You can’t perform that action at this time.
0 commit comments