From 64710ad813e8931eb427d994f782bf2b508f58ed Mon Sep 17 00:00:00 2001 From: Karan Kamatgi Date: Fri, 29 Oct 2021 12:53:07 -0700 Subject: [PATCH] check docker engine is running before build --- build.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index a07197b..f135ddd 100755 --- a/build.sh +++ b/build.sh @@ -7,8 +7,7 @@ user_in_group() validate_user() { - if user_in_group $USER docker; - then + if user_in_group $USER docker; then echo "The user $USER is part of docker group; continue building....." else printf "The user $USER isn't part of the docker group, please add, verify the group membership is re-evaluated and re-run build.sh; exiting...\n" @@ -18,6 +17,11 @@ validate_user() #check if docker is installed; exit if otherwise if [ -x "$(command -v docker)" ]; then + #check docker engine is running + if ! docker info > /dev/null 2>&1; then + echo "This build script uses docker, and it isn't running - please start docker and try again!" + exit 1 + fi if grep -q docker /etc/group; then validate_user @@ -31,6 +35,7 @@ else exit 1 fi + printf "\n ***** If you are behind proxies, please ensure proxy settings are configured at builder/Dockerfile *****\n " #build docker image