nextcloudpi/docker.sh
Tobias K 9b7602540d
build/armbian/armbian.sh: Make sure to stop dockerd after installation
Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
2024-01-07 10:32:57 +01:00

48 lines
1.4 KiB
Bash

#!/bin/bash
APTINSTALL="apt-get install -y --no-install-recommends"
export DEBIAN_FRONTEND=noninteractive
install() {
apt-get update
local pre_reqs=(apt-transport-https ca-certificates curl)
command -v gpg || pre_reqs+=(gnupg)
$APTINSTALL "${pre_reqs[@]}"
local lsb_dist=debian
local dist_version=bullseye
mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/$lsb_dist/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$lsb_dist $dist_version stable" > /etc/apt/sources.list.d/docker.list
apt-get update
# rm /var/cache/ldconfig/aux-cache
# /sbin/ldconfig*
# $APTINSTALL --reinstall install libc-bin
#apt-mark auto libc-bin
$APTINSTALL docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin cgroupfs-mount
if [[ "$INIT_SYSTEM" == "chroot" ]] || [[ "$INIT_SYSTEM" == "armbian-build" ]]
then
containerd &
dockerd --iptables=false &
fi
success=false
for i in {1..10}
do
sleep 5
if docker run --rm hello-world
then
success=true
else
echo "Docker failed to start (attempt ${i}/10)"
fi
done
[[ "$success" == "true" ]] || exit 1
docker rmi hello-world:latest
}
configure() { :; }