From 6d2155ef95077ebf1b64c136ee6a77365687ad9b Mon Sep 17 00:00:00 2001 From: Rohit T P Date: Sat, 20 Apr 2024 13:41:43 +0000 Subject: [PATCH] feat: warn if docker is not running --- docker-compose/setup-script/noco.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docker-compose/setup-script/noco.sh b/docker-compose/setup-script/noco.sh index 36c13833de..33dcd194e5 100755 --- a/docker-compose/setup-script/noco.sh +++ b/docker-compose/setup-script/noco.sh @@ -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:"