2

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.

1

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.