-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-install.sh
executable file
·108 lines (96 loc) · 3.41 KB
/
docker-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
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
#!/usr/bin/env bash
set -e
source ./docker-install-helper.sh
echo $1
function passline () {
echo "."
echo "."
echo $1
}
# echo "---=[ DOCKER INSTALLER ]=---"
if [[ -z $1 ]];then
echo ""
echo "=-"
echo "./docker-install.sh [-option-os]"
echo "=-"
echo ""
else
if [[ $2 = "--default" ]] && [[ -z $3 ]];then
if [[ $1 = "-fedora" ]];then
passline "adding epel-release repository"
yum install -y epel-release
echo "|- done"
fi
passline "uninstalling old version of docker.."
package-remover $1
passline "configure helper tool.."
repo-config $1
passline "configure stable repo.."
repo-stable $1
passline "docker install.."
docker-install $1
passline "enable service"
endis-docker start
else
if [[ $2 = "--add" ]];then
case $3 in
"portainer")
if [[ $(docker volume ls | grep portainer_data > /dev/null ;echo $?) -gt 0 ]];then
docker volume create portainer_data
else
echo "portainer volume is Existed"
fi
function create_container_portainer () {
# $1 container_name
# $2 expose_port
docker run -d \
--name $1 \
-p $2:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer
}
# command -bas_os --add portainer "portainer-d" 12345
if [[ -z $5 ]];then
if [[ $(is_number $4) = "false" ]];then
# command -base_os --add portainer 12345 <- port
create_container_portainer "portainer" $4
else
# command -base_od --add portainer "portainer-d" <- containe_name
create_container_portainer $4 9000
fi
elif [[ -z $4 ]];then
create_container_portainer "portainer" 9000
else
# $4 - container_name
# $5 - expose_port
create_container_portainer $4 $5
fi
docker ps -a | grep portainer
;;
"docker-compose")
if ! [[ -z $4 ]]; then
echo "|- ./docker-install.sh [base_os] --add docker-compose"
echo "|-- there is no optional here :> sorry"
else
if [[ ishas-docker-compose == true ]]; then
echo "|-- docker-compose exist at : $(which docker-compose) :>"
else
echo "|- installing docker-compose.."
docker-compose-install
fi
fi
;;
*)
echo "--add option :"
echo "|- portainer : dashboard container portainer installer"
echo "|- docker-compose : docker-compose installer"
echo "|"
echo "|-- pull request for other :>"
esac
else
echo "./docker-install.sh [-option-os] --add [-option-add]"
fi
fi
fi
# echo "---=[ DONE ]=---"