-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
66 lines (52 loc) · 1.94 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /bin/sh
if [[ ! -e /etc/docker/daemon.json ]];then
mkdir /etc/docker/
cat <<EOT > /etc/docker/daemon.json
{
"registry-mirrors":["https://almtd3fa.mirror.aliyuncs.com"]
}
EOT
fi
DISTRO='CentOS'
if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
DISTRO='CentOS'
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
DISTRO='Fedora'
elif grep -Eqi "Red Hat Enterprise Linux" /etc/issue || grep -Eq "Red Hat Enterprise Linux" /etc/*-release; then
DISTRO='RHEL'
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
DISTRO='Debian'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
DISTRO='Ubuntu'
else
DISTRO='unknow'
fi
if [[ ${DISTRO} == "CentOS" ]];then
echo "docker installing on CentOS"
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
sudo systemctl enable docker
fi
if [[ ${DISTRO} == "Debian" || ${DISTRO} == "Ubuntu" ]];then
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
fi
if [[ ${DISTRO} == "Fedora" ]];then
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
fi
if [[ ${DISTRO} == "RHEL" ]];then
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
fi
if [[ ! -e /usr/local/bin/docker-compose ]];then
sudo curl -L "https://github.com/docker/compose/releases/download/1.18.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
fi
if [[ -e /usr/local/bin/docker-compose ]];then
sudo chmod +x /usr/local/bin/docker-compose
else
echo "download docker-compose fail exec sh install.sh again."
exit
fi
service docker start
docker-compose build
docker-compose up -d