-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_docker.sh
More file actions
executable file
·90 lines (72 loc) · 2.16 KB
/
install_docker.sh
File metadata and controls
executable file
·90 lines (72 loc) · 2.16 KB
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
#! /bin/bash
GREEN=$(tput setaf 2)
LIME_YELLOW=$(tput setaf 190)
YELLOW=$(tput setaf 3)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
CYAN=$(tput setaf 6)
# last instal docker compose git repo NEXT SCRIPT
#COMPOSE_VERSION=`git ls-remote https://github.com/docker/compose | grep refs/tags | grep -oE "[0-9]+\.[0-9][0-9]+\.[0-9]+$" | sort --version-sort | tail -n 1`
do_install(){
if exist docker;then
docker_version="$(docker -v | cut -d ' ' -f3 | cut -d ',' -f1)"
echo "${GREEN} Docker ESTA INSTALADO - ${POWDER_BLUE} VERSION: $docker_version"
else
echo "${CYAN}INSTALANDO DOCKER . . ."
if [ "$user" != 'root' ]; then
if exist sudo; then
sh_c='sudo -E sh -c'
else
cat >&2 <<-'EOF'
${RED} Error: Es necesario usuario root
EOF
exit 1
fi
fi #check root comands
## exec comands install
before_install
echo "${BLUE} Descargando GPG"
echo "${GREEN} Descargando ..."
echo `curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -qq - >/dev/null`
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
echo ""
echo " ${LIME_YELLOW} instalacion correctamente "
echo ""
echo "********************************************"
echo ""
echo ""
echo ""
echo " Docker version : ${BLUE} $(docker -v | cut -d ' ' -f3 | cut -d ',' -f1)"
echo ""
echo ""
echo "${LIME_YELLOW}"
echo "*********************************************"
fi #check docker
}
before_install(){
# sudo dpkg --configure -a # erro install dpkg
echo "${BLUE} Actualizando"
echo "${YELLOW}"
sudo apt-get update
#echo $(id -un 2>/dev/null || true)
echo "${BLUE} Instalando requerisitos"
echo "${YELLOW}"
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
}
exist(){
command -v "$@" > /dev/null 2>&1
}
#EXEC METHOD INTALL
do_install