Go to file
2025-01-26 14:47:36 +01:00
install-docker.sh Docker containers should start at boottime. 2025-01-26 14:47:36 +01:00
README.install-latest Docker containers should start at boottime. 2025-01-26 14:47:36 +01:00

# ----------
# Install latest version of docker on debian
# ----------

# see also:
#     https://docs.docker.com/engine/install/debian/


# Update reposotories
#
apt update


# einige vorausgesetzte Pakete, damit apt Pakete über HTTPS nutzen kann:
#
apt install apt-transport-https ca-certificates curl software-properties-common


# Create directory for apt keyrings
#
install -m 0755 -d /etc/apt/keyrings


# GPG-Schlüssel für das offizielle Docker-Repository hinzufügen:
#
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc


# Give read permissions to all over the world
#
chmod a+r /etc/apt/keyrings/docker.asc


# Add the repository to Apt sources:
#
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null



# Install the latest version
#
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin



# Configure Docker to start on boot with systemd
#
# On Debian and Ubuntu, the Docker service starts on boot by default. To automatically start 
# Docker and containerd on boot for other Linux distributions using systemd, run the following 
# commands:
#
#     systemctl enable docker.service
#     systemctl enable containerd.service
#
# To stop this behavior, use 'disable' instead.
#
#     systemctl disable docker.service
#     systemctl disable containerd.service
#
systemctl enable containerd.service
systemctl enable docker.service

# !! Note !!
#
# if enabling 'docker service' failed, you can try to manually set the symlink that causes 
# automatic booting:
#
#     ln -s /lib/systemd/system/docker.service /etc/systemd/system/multi-user.target.wants/

systemctl daemon-reload


# ----------
# !! TIP !!
#
# Receiving errors when trying to run without root?
#
# The docker user group exists but contains no users, which is why you're required to use sudo 
# to run Docker commands. Continue to 
#
#     https://docs.docker.com/engine/install/linux-postinstall (Linux postinstall)
#
# to allow non-privileged users to run  Docker commands and for other optional configuration steps.
# ----------