From 5b92673cc5eed5d258c89378ad7032c69fe080c8 Mon Sep 17 00:00:00 2001 From: "Michael G. Noll" Date: Mon, 6 May 2024 19:37:24 +0200 Subject: [PATCH] Fail if docker command is not available --- create_image.sh | 6 ++++++ start_container.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/create_image.sh b/create_image.sh index e297d20..be09f40 100755 --- a/create_image.sh +++ b/create_image.sh @@ -8,6 +8,12 @@ set -uo pipefail # Import environment variables from .env set -o allexport && source .env && set +o allexport +# Check requirements +if ! command -v docker &> /dev/null; then + echo "ERROR: 'docker' command not available. Is Docker installed?" + exit 1 +fi + echo "Building image '$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG'..." # TIP: Add `--progress=plain` to see the full docker output when you are # troubleshooting the build setup of your image. diff --git a/start_container.sh b/start_container.sh index b1d2f25..3d840bf 100755 --- a/start_container.sh +++ b/start_container.sh @@ -8,6 +8,12 @@ set -uo pipefail # Import environment variables from .env set -o allexport && source .env && set +o allexport +# Check requirements +if ! command -v docker &> /dev/null; then + echo "ERROR: 'docker' command not available. Is Docker installed?" + exit 1 +fi + # Force amd64 as the platform. This workaround is needed on Apple Silicon # machines. Details at https://stackoverflow.com/questions/72152446/. declare -r DOCKER_OPTIONS="--platform linux/amd64"