Do Until (BASH)

I’m currently running GitLab in a Docker container and wanted a little Bash script to let me know when the container is healthy (e.g. ready) after reboot.

The script uses an until command to ask Docker to list the containers, looking for the word ‘Healthy’ and until the word is found it outputs that it is waiting, then sleeps for 1 seconds. Once the word ‘Healthy’ is detected the until loop ends and outputs that GitLab is ready.


until docker container ls | grep 'healthy'
        echo "Waiting for GitLab"
        sleep 1

echo -e "GitLab ready"