feat: use Ubuntu native docker.io packages for Ubuntu 26.04+

Ubuntu 26.04+ ships Docker in its own repositories, so install
docker.io, docker-compose-v2, and docker-buildx directly from apt
instead of adding Docker's official repository. Falls back to the
official repo method for older Ubuntu versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
FlintyLemming
2026-04-07 20:25:42 +08:00
parent 4967286abb
commit 0438a7339a
+30 -1
View File
@@ -555,7 +555,36 @@ do_install() {
# Run setup for each distro accordingly # Run setup for each distro accordingly
case "$lsb_dist" in case "$lsb_dist" in
ubuntu|debian|raspbian) ubuntu)
# Check if Ubuntu version is 26.04 or higher — use native docker.io packages
ubuntu_major_version=""
if [ -r /etc/os-release ]; then
ubuntu_major_version="$(. /etc/os-release && echo "$VERSION_ID" | cut -d'.' -f1)"
fi
if [ -n "$ubuntu_major_version" ] && [ "$ubuntu_major_version" -ge 26 ]; then
echo "# Ubuntu $ubuntu_major_version detected — installing Docker from Ubuntu repositories"
(
if ! is_dry_run; then
set -x
fi
$sh_c 'apt-get -qq update >/dev/null'
# Try installing directly; if packages not found, enable Universe repo and retry
if ! $sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install docker.io docker-compose-v2 docker-buildx >/dev/null 2>&1"; then
$sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install software-properties-common >/dev/null"
$sh_c 'add-apt-repository -y universe >/dev/null'
$sh_c 'apt-get -qq update >/dev/null'
$sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install docker.io docker-compose-v2 docker-buildx >/dev/null"
fi
)
if [ "$NO_AUTOSTART" != "1" ]; then
start_docker_daemon
fi
echo_docker_as_nonroot
exit 0
fi
# Fall through to Docker's official repository for older Ubuntu versions
;&
debian|raspbian)
pre_reqs="ca-certificates curl" pre_reqs="ca-certificates curl"
apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL" apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL"
( (