-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker.sh
215 lines (215 loc) · 12.6 KB
/
docker.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
sleep 1
clear
echo "############################################################################"
echo "# Docker Installer #"
echo "# by Nico L. #"
echo "# https://github.com/ipexadev/scripts #"
echo "# Last Update: 27.06.2022 #"
echo "############################################################################"
sleep 3
clear
echo "############################################################################"
echo "# Checking for Root #"
echo "############################################################################"
if (( $EUID != 0 )); then
echo "############################################################################"
echo "# Please run as root #"
echo "############################################################################"
exit
fi
sleep 1
clear
echo "############################################################################"
echo "# Checked for Root #"
echo "############################################################################"
sleep 2
clear
echo "############################################################################"
echo "# Installer #"
echo "# by Nico L. #"
echo "# https://github.com/nilasystem/scripts #"
echo "############################################################################"
echo "# #"
echo "# 1 | Docker Installation #"
echo "# 2 | Docker Installation + Portainer #"
echo "# 3 | Docker Installation + Yacht #"
echo "# #"
echo "############################################################################"
read -p "Please enter a Number:" installnumber
# Docker Installation
if [ "$installnumber" = "1" ]; then
clear
sleep 1
echo "############################################################################"
echo "# Installing Docker #"
echo "############################################################################"
sleep 2
echo "############################################################################"
echo "# Server Update (apt update -y) #"
echo "############################################################################"
apt update -y
wait -n
echo "############################################################################"
echo "# Server Upgrade (apt upgrade -y) #"
echo "############################################################################"
apt upgrade -y
wait -n
echo "############################################################################"
echo "# Docker Installation (apt install docker -y) #"
echo "############################################################################"
apt install docker -y
wait -n
echo "############################################################################"
echo "# Docker-Compose Installation (apt install docker-compose -y) #"
echo "############################################################################"
apt install docker-compose -y
wait -n
echo "############################################################################"
echo "# Starting Docker (systemctl start docker) #"
echo "############################################################################"
systemctl start docker
wait -n
echo "############################################################################"
echo "# Enabling Docker (systemctl enable docker) #"
echo "############################################################################"
systemctl enable docker
wait -n
clear
echo "############################################################################"
echo "# Installed Docker #"
echo "############################################################################"
fi
# Docker Installation + Portainer
if [ "$installnumber" = "2" ]; then
clear
sleep 1
echo "############################################################################"
echo "# Installing Docker + Portainer #"
echo "############################################################################"
sleep 2
echo "############################################################################"
echo "# Server Update (apt update -y) #"
echo "############################################################################"
apt update -y
wait -n
echo "############################################################################"
echo "# Server Upgrade (apt upgrade -y) #"
echo "############################################################################"
apt upgrade -y
wait -n
echo "############################################################################"
echo "# Docker Installation (apt install docker -y) #"
echo "############################################################################"
apt install docker -y
wait -n
echo "############################################################################"
echo "# Docker-Compose Installation (apt install docker-compose -y) #"
echo "############################################################################"
apt install docker-compose -y
wait -n
echo "############################################################################"
echo "# Starting Docker (systemctl start docker) #"
echo "############################################################################"
systemctl start docker
wait -n
echo "############################################################################"
echo "# Enabling Docker (systemctl enable docker) #"
echo "############################################################################"
systemctl enable docker
wait -n
echo "############################################################################"
echo "# Docker Volume Creating (docker volume create portainer_data) #"
echo "############################################################################"
docker volume create portainer_data
wait -n
echo "############################################################################"
echo "# Enter the Name & Port #"
echo "############################################################################"
read -p "Please enter Portainer Container Name (portainer is recommended): " portainername
read -p "Please enter Portainer Port 1 (8000 is recommended): " portainerport1
read -p "Please enter Portainer Port 2 (9443 is recommended): " portainerport2
echo "############################################################################"
echo "# Downloading and Installing Portainer Container #"
echo "############################################################################"
docker run -d -p $portainerport1:$portainerport1 -p $portainerport2:$portainerport2 --name=$portainername --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
wait -n
clear
echo "############################################################################"
echo "# Installed Docker + Portainer #"
echo "# #"
echo "# Portainer Name | $portainername #"
echo "# Portainer Port1 | $portainerport1 #"
echo "# Portainer Port2 | $portainerport2 #"
echo "# #"
echo "############################################################################"
fi
# Docker Installation + Yacht
if [ "$installnumber" = "3" ]; then
clear
sleep 1
echo "############################################################################"
echo "# Installing Docker + Yacht #"
echo "############################################################################"
sleep 2
echo "############################################################################"
echo "# Server Update (apt update -y) #"
echo "############################################################################"
apt update -y
wait -n
echo "############################################################################"
echo "# Server Upgrade (apt upgrade -y) #"
echo "############################################################################"
apt upgrade -y
wait -n
echo "############################################################################"
echo "# Docker Installation (apt install docker -y) #"
echo "############################################################################"
apt install docker -y
wait -n
echo "############################################################################"
echo "# Docker-Compose Installation (apt install docker-compose -y) #"
echo "############################################################################"
apt install docker-compose -y
wait -n
echo "############################################################################"
echo "# Starting Docker (systemctl start docker) #"
echo "############################################################################"
systemctl start docker
wait -n
echo "############################################################################"
echo "# Enabling Docker (systemctl enable docker) #"
echo "############################################################################"
systemctl enable docker
wait -n
echo "############################################################################"
echo "# Docker Volume Creating (docker volume create yacht) #"
echo "############################################################################"
docker volume create yacht
wait -n
echo "############################################################################"
echo "# Enter the Name & Port #"
echo "############################################################################"
read -p "Please enter Yacht Container Name (yacht is recommended): " yachtname
read -p "Please enter Yacht Port1 (8000 is recommended): " yachtport1
echo "############################################################################"
echo "# Downloading and Installing Yacht Container #"
echo "############################################################################"
docker run -d -p $yachtport1:$yachtport1 -v /var/run/docker.sock:/var/run/docker.sock -v yacht:/config --name $yachtname selfhostedpro/yacht
wait -n
clear
echo "############################################################################"
echo "# Installed Docker + Yacht #"
echo "# #"
echo "# Yacht Name | $yachtname #"
echo "# Yacht Port1 | $yachtport1 #"
echo "# #"
echo "# Default Login: #"
echo "# #"
echo "# [email protected] #"
echo "# pass #"
echo "# #"
echo "# After logging in, you should change the Login Datas. #"
echo "# #"
echo "############################################################################"
fi