Skip to content

Instantly share code, notes, and snippets.

@louis030195
Created April 14, 2020 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louis030195/0d5687af1e0e7669c48d36070a914f1c to your computer and use it in GitHub Desktop.
Save louis030195/0d5687af1e0e7669c48d36070a914f1c to your computer and use it in GitHub Desktop.
Bash script to wait for an open port inside Docker container
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