Skip to content

Commit

Permalink
check docker engine is running before build
Browse files Browse the repository at this point in the history
  • Loading branch information
karanrk committed Oct 29, 2021
1 parent 6b0bb3b commit 64710ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 64710ad

Please sign in to comment.