Just in case a shorter version appeals to you, I think you could rewrite it like this:
timeout 60 bash -c 'until is_ready; do sleep 10; done'
You'll need to `export -f is_ready` if it's a shell function.
That's assuming you can use a timeout instead of number-of-retries.
If you're using Docker Compose, add this to your environment: environment: - WAIT_COMMAND=[ $(curl --write-out %{http_code} --silent --output /dev/null http://elastic:9200/_cat/health?h=st) = 200 ] - WAIT_START_CMD=python /code/lytten/main.py - WAIT_SLEEP=2 - WAIT_LOOPS=10
Then, create a 'wait' bash script in your app's source code that looks like this: !/bin/bash echo $WAIT_COMMAND echo $WAIT_START_CMD
Then, finally, for your nginx container, add: command: sh /code/wait_to_start.shto its specification