From dd9b521a067160f621c6adf678d9800b4f7e5468 Mon Sep 17 00:00:00 2001 From: Gustavo Trott Date: Wed, 14 Dec 2022 17:32:03 -0300 Subject: [PATCH] Add validation of Docker version --- create_bbb.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/create_bbb.sh b/create_bbb.sh index 34c77bf..cd4b7de 100755 --- a/create_bbb.sh +++ b/create_bbb.sh @@ -1,4 +1,19 @@ #!/bin/bash + +if ! command -v docker &> /dev/null +then + echo "Docker not found! Required Docker 20 or greater" + exit +fi + +DOCKER_VERSION=$(docker version -f "{{.Server.Version}}") +DOCKER_VERSION_MAJOR=$(echo "$DOCKER_VERSION"| cut -d'.' -f 1) + +if [ ! "${DOCKER_VERSION_MAJOR}" -ge 20 ] ; then + echo "Invalid Docker version! Required Docker 20 or greater" + exit +fi + NAME= DOMAIN=test IP=172.17.0.2