|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +echo "This script will install and start Docker. After running it you should install" |
| 4 | +echo "individual applications by running 'docker compose up -d' in each application's" |
| 5 | +echo "directory, or run an install script for a stack of applications." |
| 6 | +echo |
| 7 | +echo "This script uses `sudo` to run items as root; you'll be prompted at least once at" |
| 8 | +echo "the start to enter your password in order to allow this" |
| 9 | + |
| 10 | +sudo apt update && apt upgrade -y |
| 11 | +sudo apt install pwgen curl software-properties-common -y |
| 12 | + |
| 13 | +if ! command -v docker &> /dev/null; then |
| 14 | + echo "Docker not found. Installing Docker..." |
| 15 | + |
| 16 | +# sudo apt install -y apt-transport-https ca-certificates curl software-properties-common |
| 17 | + sudo apt install -y apt-transport-https ca-certificates curl |
| 18 | + sudo install -m 0755 -d /etc/apt/keyrings |
| 19 | + sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc |
| 20 | + sudo chmod a+r /etc/apt/keyrings/docker.asc |
| 21 | + |
| 22 | +# sudo add-apt-repository "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(lsb_release -cs) stable" |
| 23 | + sudo echo \ |
| 24 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ |
| 25 | + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ |
| 26 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 27 | + |
| 28 | + sudo apt update |
| 29 | +# sudo apt install -y docker-ce docker-ce-cli containerd.io |
| 30 | + sudo apt install -y docker-ce docker-ce-cli |
| 31 | + |
| 32 | + sudo systemctl start docker |
| 33 | + sudo systemctl enable docker |
| 34 | + |
| 35 | + if command -v docker &> /dev/null; then |
| 36 | + echo "Docker installed successfully!" |
| 37 | + else |
| 38 | + echo "Docker installation failed." |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | +else |
| 42 | + echo "Docker is already installed." |
| 43 | +fi |
0 commit comments