Created
April 14, 2020 12:40
-
-
Save louis030195/0d5687af1e0e7669c48d36070a914f1c to your computer and use it in GitHub Desktop.
Bash script to wait for an open port inside Docker container
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
CONTAINER_NAME=my-awesome-container | |
PORT=1337 | |
while [ ! "$(docker exec -t -i $CONTAINER_NAME curl --write-out %{http_code} --silent --output /dev/null localhost:$PORT)" = "-ne 200" ] ; do | |
echo "Waiting for port $PORT to be opened ..." | |
sleep 20 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment