forked from LTD-Beget/sprutio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-version.sh
More file actions
25 lines (18 loc) · 754 Bytes
/
Copy pathdocker-version.sh
File metadata and controls
25 lines (18 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
set -e
REQUIRED_VERSION=${1:-1.6.0}
function version2int {
printf "%03d%03d%03d%03d" $(echo "$1" | tr '.' ' ')
}
DOCKER=$(which docker 2>/dev/null)
if [ -z "$DOCKER" ]; then
echo "Docker Engine ${REQUIRED_VERSION} or later is required to run SprutIO"
echo "Please follow https://docs.docker.com/linux/ to install Docker Engine"
exit 1
fi
DOCKER_VERSION=$(docker version -f '{{.Server.Version}}' 2>/dev/null || docker version | perl -ne 'm/Server:?\s*[vV]ersion: (\S+)/ && print $1')
if [ $(version2int $DOCKER_VERSION) -lt $(version2int $REQUIRED_VERSION) ]; then
echo "Docker Engine ${REQUIRED_VERSION} or later is required to run SprutIO"
echo "Please upgrade your Docker Engine to run SprutIO"
exit 1
fi