diff --git a/linux-managements/install-docker.sh b/linux-managements/install-docker.sh index 4c481c1..646030e 100644 --- a/linux-managements/install-docker.sh +++ b/linux-managements/install-docker.sh @@ -555,7 +555,36 @@ do_install() { # Run setup for each distro accordingly 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" apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL" (