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.
#!/bin/bash until docker container ls | grep 'healthy' do echo "Waiting for GitLab" sleep 1 done echo -e "GitLab ready"