@@ -18,6 +18,22 @@ build_kb
1818fetch_tools
1919install_kind
2020
21+ # Checks if Docker is available and running.
22+ # Exits with a helpful error message if Docker is not available.
23+ function check_docker {
24+ if ! command -v docker & > /dev/null; then
25+ echo " Error: docker is not installed. Please install Docker to run e2e tests." >&2
26+ echo " Visit https://docs.docker.com/get-docker/ for installation instructions." >&2
27+ exit 1
28+ fi
29+
30+ if ! docker info & > /dev/null; then
31+ echo " Error: Docker daemon is not running. Please start Docker to run e2e tests." >&2
32+ echo " Make sure Docker Desktop is running or start the Docker daemon." >&2
33+ exit 1
34+ fi
35+ }
36+
2137# Creates a named kind cluster given a k8s version.
2238# The KIND_CLUSTER variable defines the cluster name and
2339# is expected to be defined in the calling environment.
@@ -27,11 +43,12 @@ install_kind
2743# export KIND_CLUSTER=<kind cluster name>
2844# create_cluster <k8s version>
2945function create_cluster {
46+ check_docker
3047 echo " Getting kind config..."
3148 KIND_VERSION=$1
3249 : ${KIND_CLUSTER:? " KIND_CLUSTER must be set" }
3350 : ${1:? " k8s version must be set as arg 1" }
34- if ! kind get clusters | grep -q $KIND_CLUSTER ; then
51+ if ! kind get clusters 2> /dev/null | grep -q $KIND_CLUSTER ; then
3552 version_prefix=" ${KIND_VERSION% .* } "
3653 kind_config=$( dirname " $0 " ) /kind-config.yaml
3754 if test -f $( dirname " $0 " ) /kind-config-${version_prefix} .yaml; then
0 commit comments