Skip to content

Commit

Permalink
Merge pull request #4520 from zll600/verify_docker_function
Browse files Browse the repository at this point in the history
chore: verify whether docker is available by executing docker ps command
  • Loading branch information
karmada-bot authored Jan 12, 2024
2 parents e790321 + 62f0561 commit 1e70326
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hack/local-up-karmada.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ fi
util::cmd_must_exist "go"
util::verify_go_version

# Make sure docker exists
util::cmd_must_exist "docker"
# Make sure docker is available
util::verify_docker

# install kind and kubectl
kind_version=v0.20.0
Expand Down
7 changes: 7 additions & 0 deletions hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ function util::cmd_must_exist {
fi
}

function util::verify_docker {
if ! docker ps -q >/dev/null 2>&1; then
echo "Docker is not available, Please verify docker is installed and available"
exit 1
fi
}

function util::verify_go_version {
local go_version
IFS=" " read -ra go_version <<< "$(GOFLAGS='' go version)"
Expand Down

0 comments on commit 1e70326

Please sign in to comment.