Files
netbian/modules/docker.sh
2026-01-14 13:05:05 +01:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
echo
echo " => Docker"
echo
# Check for Docker
pkgs="docker-ce
docker-ce-cli
containerd.io
docker-buildx-plugin
docker-compose-plugin"
for pkg in $pkgs
do
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -ne 0 ]; then
installed=false
fi
done
if [ -z $installed ]; then
echo "Docker found."
exit
fi
# Install needed packages
pkgs="ca-certificates
curl"
for pkg in $pkgs
do
dpkg-query -W -f='${Status}' $pkg 2>&1 | grep -q " installed"
if [ $? -ne 0 ]; then
apt-get install $pkg -y
fi
done
# Add Docker's official GPG key:
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
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
apt-get update
# Install packages
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y