Last active
July 11, 2016 13:52
-
-
Save lhess/3fb4d4ebb441bafcbc3c9b3f292ead65 to your computer and use it in GitHub Desktop.
check availability of specific port in docker-entrypoint by using netcat (example for elasticsearch)
This file contains hidden or 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
#!/usr/bin/env bash | |
echo "Stalling for Elasticsearch..." | |
for i in {30..0}; do | |
nc -q 1 elasticsearch 9200 2>/dev/null && break | |
echo "Elasticsearch init process in progress..." | |
sleep 1 | |
done | |
if [ "$i" = 0 ]; then | |
echo >&2 "Seems like Elasticsearch is not up and running! aborting..." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment