compose version changed, zsh plugin handling optimized, opt-in for enable zsh plugin, cleanup, documentation, license

This commit is contained in:
scriptos 2025-06-13 21:38:00 +02:00
parent 2746f535cd
commit f0a305f24f
3 changed files with 94 additions and 29 deletions

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023 | Patrick Asmus | scriptOS Copyright (c) 2025 | Patrick Asmus | scriptOS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,17 +1,70 @@
# Docker Installer v3 für Ubuntu-Systeme # 🐳 Docker Installer Script für Ubuntu 22.04 & 24.04
## Beschreibung Dieses Bash-Skript installiert Docker und Docker-Compose auf einem Ubuntu-System (22.04 oder 24.04), passt bei Bedarf das Docker-Root-Verzeichnis an und kann optional das OhMyZSH-Plugin für Docker aktivieren.
Das Skript "docker-installer-v3.sh" ermöglicht die Installation von Docker und Docker-Compose auf einem Ubuntu-System. Es richtet auch das Docker-Plugin für Oh My ZSH ein, um Docker-Befehle direkt in der ZSH-Shell verwenden zu können. ---
## Voraussetzungen ## ✅ Features
Stellen Sie sicher, dass Sie über eine Verbindung zum Internet verfügen und dass Sie als Benutzer mit sudo-Berechtigungen angemeldet sind, da das Skript administrative Berechtigungen benötigt, um Docker zu installieren. - Installation von:
- Docker Engine (inkl. Repository-Einbindung)
- Docker Compose (als Binärdatei, konfigurierbare Version)
- Anpassung des Docker-Datenverzeichnisses (`/var/lib/docker`)
- Erstellung eines Basisverzeichnisses für Docker-Compose-Projekte
- Optionales Aktivieren des `docker`-Plugins in der OhMyZSH-Konfiguration (`/root/.zshrc`)
- Kompatibel mit Ubuntu **22.04 Jammy** und **24.04 Noble**
## Verwendung ---
Führen Sie das Skript mit dem folgenden Befehl in einem Terminal aus: ## 🔧 Konfigurierbare Variablen
Im Skriptkopf kannst du folgende Variablen anpassen:
| Variable | Beschreibung | Wert |
|----------------------|------------------------------------------------------------------------------|------------------------------|
| `USER` | Der Benutzer, dem Docker-Rechte zugewiesen werden sollen | `root` |
| `COMPOSEVERSION` | Die zu installierende Docker-Compose-Version | `v2.37.1` |
| `DOCKER_ROOT_DIR` | Zielverzeichnis für Docker-Daten | `/var/lib/docker` |
| `COMPOSE_DIR` | Verzeichnis für zukünftige Compose-Projekte | `/home/docker-projekte` |
| `ENABLE_ZSH_PLUGIN` | Aktiviert das OhMyZSH-Plugin für Docker | `true` / `false` |
---
## ▶️ Ausführung
```bash ```bash
bash ./docker-installer.v3.sh # 1. Skript herunterladen (z.B. mit wget)
wget https://git.techniverse.net/scriptos/linux-docker-installer/raw/branch/main/docker-installer-ubuntu.v3.sh
# 2. Ausführbar machen
chmod +x docker-installer-ubuntu.v3.sh
# 3. Als root oder mit sudo ausführen
sudo bash ./docker-installer-ubuntu.v3.sh
``` ```
[![asciicast](https://asciinema.it-nerds.com/a/53.svg)](https://asciinema.it-nerds.com/a/53)
---
## 🔗 Repository
Mehr unter: [https://www.cleveradmin.de](https://www.cleveradmin.de)
Source: [https://git.techniverse.net/scriptos/public-linux-docker-installer](https://git.techniverse.net/scriptos/public-linux-docker-installer)
---
## 💬 Support & Community
Du hast Fragen, brauchst Unterstützung bei der Einrichtung oder möchtest dich einfach mit anderen austauschen, die ähnliche Projekte betreiben? Dann schau gerne in unserer Techniverse Community vorbei:
👉 **Matrix-Raum:** [#community:techniverse.net](https://matrix.to/#/#community:techniverse.net)
Wir freuen uns auf deinen Besuch und helfen dir gerne weiter!
<p align="center">
<img src="https://assets.techniverse.net/f1/git/graphics/gray0-catonline.svg" alt="">
</p>
<p align="center">
<img src="https://assets.techniverse.net/f1/logos/small/license.png" alt="License" width="15" height="15"> <a href="./public-linux-docker-installer/src/branch/main/LICENSE">License</a> | <img src="https://assets.techniverse.net/f1/logos/small/matrix2.svg" alt="Matrix" width="15" height="15"> <a href="https://matrix.to/#/#community:techniverse.net">Matrix</a> | <img src="https://assets.techniverse.net/f1/logos/small/mastodon2.svg" alt="Matrix" width="15" height="15"> <a href="https://social.techniverse.net/@donnerwolke">Mastodon</a>
</p>

View File

@ -1,17 +1,20 @@
#!/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 und Ubuntu 24.04
# Aufruf: bash ./docker-installer.v3.sh
# Autor: Patrick Asmus # Autor: Patrick Asmus
# Web: https://www.techniverse.net # Web: https://www.cleveradmin.de
# Git-Reposit.: https://git.techniverse.net/scriptos/linux-docker-installer # Git-Reposit.: https://git.techniverse.net/scriptos/linux-docker-installer
# Version: 3.4.5 # Version: 3.5
# Datum: 15.11.2024 # Datum: 13.06.2025
# Modifikation: change docker-compose version # Modifikation: compose version changed, zsh plugin handling optimized, opt-in for enable zsh plugin, cleanup
##################################################### #####################################################
# Variablen: # Konfiguration
COMPOSEVERSION="v2.30.3" USER="root"
COMPOSEVERSION="v2.37.1"
DOCKER_ROOT_DIR="/var/lib/docker"
COMPOSE_DIR="/home/docker-projekte"
ENABLE_ZSH_PLUGIN=false
# Betriebssystem und Version prüfen # Betriebssystem und Version prüfen
OS=$(lsb_release -is) OS=$(lsb_release -is)
@ -22,11 +25,6 @@ if [ "$OS" != "Ubuntu" ] || { [ "$VERSION" != "22.04" ] && [ "$VERSION" != "24.0
exit 1 exit 1
fi fi
# Variablen
USER="root"
DOCKER_ROOT_DIR="/var/docker-bin"
COMPOSE_DIR="/home/docker-container"
# 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
@ -54,14 +52,28 @@ sudo systemctl start docker
mkdir -p $COMPOSE_DIR mkdir -p $COMPOSE_DIR
# Docker-compose installieren (gleicher Prozess für beide Versionen) # Docker Compose installieren
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/download/$COMPOSEVERSION/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: OhMyZSH Plugin für Docker aktivieren
echo "OhMyZSH Plugin für Docker hinzufügen" if [ "$ENABLE_ZSH_PLUGIN" = true ]; then
sudo sed -i 's/plugins=(git)/plugins=(git docker)/g' /root/.zshrc ZSHRC="/root/.zshrc"
echo "OhMyZSH Plugin für Docker prüfen..."
if grep -q "^plugins=" "$ZSHRC"; then
if grep -q "docker" "$ZSHRC"; then
echo "Docker ist bereits als Plugin eingetragen keine Änderung nötig."
else
echo "Docker wird als Plugin hinzugefügt..."
sudo sed -i '/^plugins=/ s/)/ docker)/' "$ZSHRC"
fi
else
echo "WARNUNG: Keine Plugin-Zeile gefunden in $ZSHRC."
fi
else
echo "OhMyZSH Plugin-Konfiguration übersprungen (deaktiviert)."
fi
# Überprüfen der Installation # Überprüfen der Installation
docker --version docker --version