feat: warn if docker is not running

This commit is contained in:
Rohit T P
2024-04-20 13:41:43 +00:00
parent 3634e71264
commit 6d2155ef95

View File

@@ -543,9 +543,25 @@ $(declare -f read_number)
$(declare -f read_number_range)
check_if_docker_is_running() {
yellow="\033[1;33m"
nocolor="\033[0m"
blue="\033[1;34m"
if ! $DOCKER_COMMAND ps >/dev/null 2>&1; then
echo "+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+"
echo -e "| \${yellow}Warning ! \${nocolor} |"
echo "| Docker is not running. Most of the commands will not work without Docker. |"
echo "| Use the following command to start Docker: |"
echo -e "| \${blue} sudo systemctl start docker \${nocolor} |"
echo "+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+"
fi
}
# Function to display the menu
show_menu() {
# clear
clear
check_if_docker_is_running
echo ""
echo \$MSG
echo "Service Management Menu:"