Skip to content

Instantly share code, notes, and snippets.

@sitemapxml
Last active August 9, 2021 20:39
Show Gist options
  • Save sitemapxml/e58f3da8f5ec65b188ee303950b5783e to your computer and use it in GitHub Desktop.
Save sitemapxml/e58f3da8f5ec65b188ee303950b5783e to your computer and use it in GitHub Desktop.
Instalacija Docker-a na Debian 10
#!/bin/bash
# Instalacija ##############################################################
# ##########################################################################
# git clone https://gist.github.com/e58f3da8f5ec65b188ee303950b5783e.git
# mv e58f3da8f5ec65b188ee303950b5783e/docker-install.sh ./docker-install.sh
# chmod +x ./docker-install.sh
# rm -r e58f3da8f5ec65b188ee303950b5783e
# ##########################################################################
# nakon toga samo pokrenuti:
# ./docker-install.sh
# ##########################################################################
# Definicije boja
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
# Reset boja
NC='\033[0m'
printf "${YELLOW}Ova skripta će instalirati Docker, Rancher kontrolnu tablu i sve pootrebne biblioteke.${NC}\n"
read -p "Pritisnite [Enter] da bi ste nastavili"
printf "${YELLOW}Instalacija neophodnih biblioteka${NC}\n"
sleep 0.5s
apt-get install apt-transport-https ca-certificates curl software-properties-common -y
printf "${YELLOW}Instalacija ngupg i gnupg2${NC}\n"
sleep 0.5s
apt-get install gnupg -y
apt-get install gnupg2 -y
printf "${YELLOW}Dodavanje ključa${NC}\n"
sleep 0.5s
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
printf "${YELLOW}Dodavanje repozitorije na listu repozitorija${NC}\n"
sleep 0.5s
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list.d/docker.list
printf "${YELLOW}Osvežavanje liste repozitorija${NC}\n"
sleep 0.5s
apt-get update
printf "${YELLOW}Docker instalacija${NC}\n"
sleep 0.5s
apt-get install docker-ce -y
printf "${YELLOW}Rancher instalacija${NC}\n"
sleep 0.5s
sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
docker -v
if [ "$?" = 127 ]; then
printf "${RED}Došlo je do greške pri instalaciji. Molimo pokušajte ponovo.${NC}\n"
else
printf "${GREEN}Docker je uspešno instaliran.\n"
printf "${GREEN}Rancher kontrolnoj tabli možete pristupiti putem porta 8080.${NC}\n"
fi
# Brisanje istorije
cat /dev/null > ~/.bash_history && history -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment