Compare commits

..

No commits in common. "31eb235ca412c713444da06aec09239e41cc0c03" and "274387b780b84feb430b442bbcd84ec73d10d2fb" have entirely different histories.

View File

@ -1,24 +1,21 @@
#!/bin/bash #!/bin/bash
# Script Name: docker-installer.v3.sh # Script Name: docker-installer.v3.sh
# Beschreibung: Docker & Docker-Compose Installer für Ubuntu 22.04 Jammy und Ubuntu 24.04 # Beschreibung: Docker & Docker-Compose Installer für "Ubuntu 22.04 Jammy" only
# Aufruf: bash ./docker-installer.v3.sh # Aufruf: bash ./docker-installer.v3.sh
# Autor: Patrick Asmus # Autor: Patrick Asmus
# Web: https://www.techniverse.net # Web: https://www.techniverse.net
# Git-Reposit.: https://git.techniverse.net/scriptos/linux-docker-installer # Git-Reposit.: https://git.techniverse.net/scriptos/linux-docker-installer
# Version: 3.4.2 # Version: 3.3
# Datum: 12.06.2024 # Datum: 08.04.2024
# Modifikation: Docker-Compose Verion auf "v2.27.1" erhöht # Modifikation: Script now checks OS before installation
##################################################### #####################################################
# Variablen:
COMPOSEVERSION="v2.27.1"
# Betriebssystem und Version prüfen # Betriebssystem und Version prüfen
OS=$(lsb_release -is) OS=$(lsb_release -is)
VERSION=$(lsb_release -rs) VERSION=$(lsb_release -rs)
if [ "$OS" != "Ubuntu" ] || { [ "$VERSION" != "22.04" ] && [ "$VERSION" != "24.04" ]; }; then if [ "$OS" != "Ubuntu" ] || [ "$VERSION" != "22.04" ]; then
echo "Dieses Script unterstützt nur Ubuntu 22.04 und Ubuntu 24.04. Installation abgebrochen." echo "Dieses Script ist nur für Ubuntu 22.04 geeignet. Installation abgebrochen."
exit 1 exit 1
fi fi
@ -30,33 +27,25 @@ COMPOSE_DIR="/docker-compose"
# Docker installieren # Docker installieren
sudo apt update sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
if [ "$VERSION" == "22.04" ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 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 echo "deb [arch=amd64 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
elif [ "$VERSION" == "24.04" ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
fi
sudo apt update sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
# Docker-Root-Verzeichnis ändern & Compose Verzeichnis erstellen # Docker-Root-Verzeichnis ändern & Compose Verzeichnis erstellen
sudo systemctl stop docker sudo systemctl stop docker
sudo mkdir -p $DOCKER_ROOT_DIR sudo mkdir -p $DOCKER_ROOT_DIR
echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json > /dev/null echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json
cp /var/lib/docker/* $DOCKER_ROOT_DIR -r cp /var/lib/docker/* $DOCKER_ROOT_DIR
rm -R /var/lib/docker rm -R /var/lib/docker
sudo systemctl start docker sudo systemctl start docker
mkdir -p $COMPOSE_DIR mkdir $COMPOSE_DIR
# Docker-compose installieren (gleicher Prozess für beide Versionen) # Docker-compose installieren
sudo apt install -y curl sudo apt install -y curl
sudo curl -L "https://github.com/docker/compose/releases/download/$COMPOSEVERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 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 sudo chmod +x /usr/local/bin/docker-compose
# Optional: Plugin für Oh my ZSH aktivieren # Optional: Plugin für Oh my ZSH aktivieren