Skip to content

Commit 0435d57

Browse files
mplsgrantwillcl-ark
authored andcommitted
add docker checks
1 parent 6423c2f commit 0435d57

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

resources/scripts/setup_minikube.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,30 @@ print_partial_message() {
3939

4040
echo -e "${color}${pre_message}${format}${formatted_part}${RESET}${color}${post_message}${RESET}"
4141
}
42+
43+
docker_path=$(command -v docker || true)
44+
if [ -n "$docker_path" ]; then
45+
print_partial_message " ⭐️ Found " "docker" ": $docker_path" "$BOLD"
46+
else
47+
print_partial_message " 💥 Could not find " "docker" ". Please follow this link to install Docker Engine..." "$BOLD"
48+
print_message "" " https://docs.docker.com/engine/install/" "$BOLD"
49+
ERROR_CODE=127
50+
fi
51+
52+
current_user=$(whoami)
53+
current_context=$(docker context show)
54+
if id -nG "$current_user" | grep -qw "docker"; then
55+
print_partial_message " ⭐️ Found " "$current_user" " in the docker group" "$BOLD"
56+
elif [ "$current_context" == "rootless" ]; then
57+
print_message " " "⭐️ Running Docker as rootless" "$BOLD"
58+
elif [[ "$(uname)" == "Darwin" ]]; then
59+
print_message " " "⭐️ Running Docker on Darwin" "$BOLD"
60+
else
61+
print_partial_message " 💥 Could not find " "$current_user" " in the docker group. Please add it like this..." "$BOLD"
62+
print_message "" " sudo usermod -aG docker $current_user && newgrp docker" "$BOLD"
63+
ERROR_CODE=1
64+
fi
65+
4266
if [ $ERROR_CODE -ne 0 ]; then
4367
print_message "" "There were errors in the setup process. Please fix them and try again." "$BOLD"
4468
exit $ERROR_CODE

0 commit comments

Comments
 (0)