Check for docker version

Closes coop-cloud/abra#15.
This commit is contained in:
decentral1se 2021-03-20 22:00:02 +01:00
parent bada24f3f6
commit 2f1f51bad1
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
2 changed files with 11 additions and 0 deletions

View File

@ -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)) - 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)) - 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 <app> version`) ([#108](https://git.autonomic.zone/coop-cloud/abra/issues/108)) - Add specific app version checking command (`abra app <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) # abra 0.6.0 (2021-03-17)

10
abra
View File

@ -476,6 +476,15 @@ require_yq() {
esac 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 # 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 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" error "direnv is blocked, run direnv allow"
@ -1847,6 +1856,7 @@ sub_network() {
abra() { abra() {
require_bash_4 require_bash_4
require_docker_version
# TODO (3wc): we either need to do this, or add 'shellcheck disable' all over # TODO (3wc): we either need to do this, or add 'shellcheck disable' all over
# the place to handle the dynamically-defined vars # the place to handle the dynamically-defined vars