allow modification of docker root directory
This commit is contained in:
parent
0dc737ac2f
commit
5fc736cdda
@ -1,16 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Script Name: docker-installer.v3.sh
|
||||
# Beschreibung: Docker & Docker-Compose installieren (Für Ubuntu)
|
||||
# Beschreibung: Docker & Docker-Compose installieren und Docker-Root-Verzeichnis ändern (Für Ubuntu)
|
||||
# Aufruf: bash ./docker-installer.v3.sh
|
||||
# Autor: Patrick Asmus
|
||||
# Web: https://www.media-techport.de
|
||||
# Git-Reposit.: https://git.media-techport.de/scriptos/docker-installer
|
||||
# Version: 3.0.1
|
||||
# Datum: 11.06.2023
|
||||
# Version: 3.1
|
||||
# Datum: 22.02.2024
|
||||
#####################################################
|
||||
|
||||
# Variablen
|
||||
USER="root"
|
||||
DOCKER_ROOT_DIR="/docker"
|
||||
COMPOSE_DIR="/compose"
|
||||
|
||||
# Docker installieren
|
||||
sudo apt update
|
||||
@ -19,22 +21,28 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o
|
||||
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
|
||||
sudo apt update
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Docker-Root-Verzeichnis ändern
|
||||
sudo mkdir -p $DOCKER_ROOT_DIR
|
||||
sudo systemctl stop docker
|
||||
echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json
|
||||
sudo systemctl start docker
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Erstelle Compose-Verzeichnis
|
||||
mkdir $COMPOSE_DIR
|
||||
|
||||
# Docker-compose installieren
|
||||
sudo apt install -y curl
|
||||
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
|
||||
|
||||
# Optional: Ordner erstellen und Plugin für Oh my ZSH aktivieren
|
||||
mkdir /docker
|
||||
touch /docker/docker-compose.yaml
|
||||
echo OhMyZSH Plugin für Docker hinzufügen
|
||||
# Optional: Plugin für Oh my ZSH aktivieren
|
||||
echo "OhMyZSH Plugin für Docker hinzufügen"
|
||||
sudo sed -i 's/plugins=(git)/plugins=(git docker)/g' /root/.zshrc
|
||||
|
||||
# Überprüfen der Installation
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user