Reputation: 248
The mongodb docker container takes few seconds to receive connections on the specified port. I would like to know how we can check if that port is up before continuing.
Upvotes: 2
Views: 2856
Reputation: 248
If mongodb is configured to accepted connection on localhost:27017
then run the following command:
TIMEOUT=30; until $(curl --output /dev/null --silent --fail localhost:27017); do printf '.'; sleep 1; if [[ $var -eq ${TIMEOUT} ]] ; then exit 1; fi; var=$((var+1)); done
Upvotes: 3