From 2f1f51bad153085dd17961c00e11587330b16319 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sat, 20 Mar 2021 22:00:02 +0100 Subject: [PATCH] Check for docker version Closes https://git.autonomic.zone/coop-cloud/abra/issues/15. --- CHANGELOG.md | 1 + abra | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0afa0d1..96319a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Show correct status for apps deployed on servers with missing context ([#99](https://git.autonomic.zone/coop-cloud/abra/issues/99)) - Search for subcommands in descending order of how many components there are ([#108](https://git.autonomic.zone/coop-cloud/abra/issues/108)) - Add specific app version checking command (`abra app version`) ([#108](https://git.autonomic.zone/coop-cloud/abra/issues/108)) +- Add docker version check (guestimating < v20 is a bad idea) ([#15](https://git.autonomic.zone/coop-cloud/abra/issues/15)) # abra 0.6.0 (2021-03-17) diff --git a/abra b/abra index 07ecdb2..a0921b6 100755 --- a/abra +++ b/abra @@ -476,6 +476,15 @@ require_yq() { esac } +require_docker_version (){ + major_version=$(docker version --format "{{.Server.Version}}" | cut -d'.' -f1) + + if [[ "$major_version" -lt 20 ]]; then + error "This tool requires Docker v20 or greater. Please upgrade your Docker installation" + exit 1 + fi +} + # FIXME 3wc: update or remove if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then error "direnv is blocked, run direnv allow" @@ -1847,6 +1856,7 @@ sub_network() { abra() { require_bash_4 + require_docker_version # TODO (3wc): we either need to do this, or add 'shellcheck disable' all over # the place to handle the dynamically-defined vars