-
Notifications
You must be signed in to change notification settings - Fork 10
/
install_docker.sh
37 lines (27 loc) · 1.12 KB
/
install_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
#!/bin/bash
# Colors for user feedback
GREEN="\033[0;32m"
RESET="\033[0m"
function installDocker() {
echo -e "Installing Docker\n"
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo -e "${GREEN}Docker Installed Successfully${RESET}"
}
function init() {
if ! command -v docker &>/dev/null; then
installDocker
else
echo -e "${GREEN}Docker is already installed.${RESET}"
fi
}
function main() {
init
}
main