Skip to content

Commit

Permalink
Updated check for docker command
Browse files Browse the repository at this point in the history
  • Loading branch information
judahpaul16 committed May 25, 2024
1 parent 87f6f18 commit 809b819
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,13 @@ function install() {
return 1
fi
if [$package == "docker"]; then
echo "Docker installed. Adding user to docker group..."
sudo usermod -aG docker $(whoami)
echo "User added to \`docker\` group but session must be reloaded. Please log out, log back in, and rerun the script. Exiting..."
exit 0
if [ "$package" == "docker" ]; then
if ! docker ps >/dev/null 2>&1; then
echo "Docker installed. Adding $(whoami) to the 'docker' group..."
sudo usermod -aG docker $(whoami)
echo -e "${RED}User added to \`docker\` group but the session must be reloaded to access the Docker daemon. Please log out, log back in, and rerun the script. Exiting...${NC}"
exit 0
fi
fi
}
Expand Down
12 changes: 7 additions & 5 deletions contrib/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ function install() {
return 1
fi

if [$package == "docker"]; then
echo "Docker installed. Adding user to docker group..."
sudo usermod -aG docker $(whoami)
echo "User added to \`docker\` group but session must be reloaded. Please log out, log back in, and rerun the script. Exiting..."
exit 0
if [ "$package" == "docker" ]; then
if ! docker ps >/dev/null 2>&1; then
echo "Docker installed. Adding $(whoami) to the 'docker' group..."
sudo usermod -aG docker $(whoami)
echo -e "${RED}User added to \`docker\` group but the session must be reloaded to access the Docker daemon. Please log out, log back in, and rerun the script. Exiting...${NC}"
exit 0
fi
fi
}

Expand Down

0 comments on commit 809b819

Please sign in to comment.