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.

#!/bin/bash

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

echo -e "GitLab ready"



Welcome to GeekTechStuff

my home away from home and where I will be sharing my adventures in the world of technology and all things geek.

The technology subjects have varied over the years from Python code to handle ciphers and Pig Latin, to IoT sensors in Azure and Python handling Bluetooth, to Ansible and Terraform and material around DevOps.

Let’s connect