From ea6ff67b8d4e356c3db027c4ed3e2323e49d1f35 Mon Sep 17 00:00:00 2001 From: AwlsomeAlex Date: Sun, 28 Jun 2026 22:00:58 +0000 Subject: [PATCH 1/2] feat(DooD): Enterprise Linux and Fedora support --- src/docker-outside-of-docker/install.sh | 467 ++++++++++++++++-------- 1 file changed, 312 insertions(+), 155 deletions(-) diff --git a/src/docker-outside-of-docker/install.sh b/src/docker-outside-of-docker/install.sh index ae4c7ae51..514790dc6 100755 --- a/src/docker-outside-of-docker/install.sh +++ b/src/docker-outside-of-docker/install.sh @@ -56,20 +56,45 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then USERNAME=root fi -apt_get_update() -{ - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - apt-get update -y - fi +# Package manager update function +pkg_mgr_update() { + case ${ADJUSTED_ID} in + debian) + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi + ;; + rhel) + if [ ${PKG_MGR_CMD} = "microdnf" ]; then + cache_check_dir="/var/cache/yum" + else + cache_check_dir="/var/cache/${PKG_MGR_CMD}" + fi + if [ "$(ls ${cache_check_dir}/* 2>/dev/null | wc -l)" = 0 ]; then + echo "Running ${PKG_MGR_CMD} makecache ..." + ${PKG_MGR_CMD} makecache + fi + ;; + esac } # Checks if packages are installed and installs them if not check_packages() { - if ! dpkg -s "$@" > /dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends "$@" - fi + case ${ADJUSTED_ID} in + debian) + if ! dpkg -s "$@" > /dev/null 2>&1; then + pkg_mgr_update + apt-get -y install --no-install-recommends "$@" + fi + ;; + rhel) + if ! rpm -q "$@" > /dev/null 2>&1; then + pkg_mgr_update + ${PKG_MGR_CMD} -y install "$@" + fi + ;; + esac } # Figure out correct version of a three part version number is not passed @@ -179,128 +204,261 @@ get_github_api_repo_url() { echo "${url/https:\/\/github.com/https:\/\/api.github.com\/repos}/releases" } -install_compose_switch_fallback() { - compose_switch_url=$1 - repo_url=$(get_github_api_repo_url "${compose_switch_url}") - echo -e "\n(!) Failed to fetch the latest artifacts for compose-switch v${compose_switch_version}..." - get_previous_version "${compose_switch_url}" "${repo_url}" compose_switch_version - echo -e "\nAttempting to install v${compose_switch_version}" - curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${architecture}" -o /usr/local/bin/compose-switch -} +################################################### +# Start docker-outside-of-docker installation +################################################### # Ensure apt is in non-interactive to avoid prompts export DEBIAN_FRONTEND=noninteractive -# Install dependencies -check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr wget -# Update CA certificates to ensure HTTPS connections work properly -# This is especially important for Ubuntu 24.04 (Noble) and Debian Trixie -if command -v update-ca-certificates > /dev/null 2>&1; then - update-ca-certificates -fi -if ! type git > /dev/null 2>&1; then - check_packages git -fi - # Source /etc/os-release to get OS info . /etc/os-release -# Fetch host/container arch. -architecture="$(dpkg --print-architecture)" -# Prevent attempting to install Moby on Debian trixie or Ubuntu resolute (packages not available) -if [ "${USE_MOBY}" = "true" ] && ([ "${VERSION_CODENAME}" = "trixie" ] || [ "${VERSION_CODENAME}" = "resolute" ]); then - err "The 'moby' option is not supported on ${ID} '${VERSION_CODENAME}' because 'moby-cli' and related system packages are not available in that distribution." - err "To continue, either set the feature option '\"moby\": false' or use a different base image (for example: 'debian:bookworm' or 'ubuntu-24.04')." - exit 1 -fi - -# Check if distro is supported -if [ "${USE_MOBY}" = "true" ]; then - if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then - err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution" - err "Supported distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" +# Determine adjusted ID and package manager +if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then + ADJUSTED_ID="debian" + PKG_MGR_CMD="apt-get" + # Use dpkg for Debian-based systems + architecture="$(dpkg --print-architecture 2>/dev/null || uname -m)" +elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* ]]; then + ADJUSTED_ID="rhel" + # Determine the appropriate package manager for RHEL-based systems + for pkg_mgr in dnf microdnf; do + if command -v "$pkg_mgr" >/dev/null 2>&1; then + PKG_MGR_CMD="$pkg_mgr" + break + fi + done + + if [ -z "${PKG_MGR_CMD}" ]; then + err "Unable to find a supported package manager (dnf, microdnf)" exit 1 fi - echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'" + + architecture="$(rpm --eval '%{_arch}' 2>/dev/null || uname -m)" else - if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then - err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution" - err "Supported distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" - exit 1 - fi - echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}'" + err "Linux distro ${ID} not supported." + exit 1 fi -# Set up the necessary apt repos (either Microsoft's or Docker's) +# Check if distribution supports Moby if [ "${USE_MOBY}" = "true" ]; then + case "${VERSION_CODENAME}" in + resolute) + err "The 'moby' option is not supported on Ubuntu '${VERSION_CODENAME}' because Moby packages are not yet available." + err "To continue, either set feature option '\"moby\": false' or use an earlier Ubuntu release (for example: ubuntu-24.04)." + exit 1 + ;; + trixie) + err "The 'moby' option is not supported on Debian '${VERSION_CODENAME}' because Moby packages are not yet available." + err "To continue, either set feature option '\"moby\": false' or use an earlier Debian release (for example: bookwork)." + exit 1 + ;; + esac - cli_package_name="moby-cli" - - # Import key safely and import Microsoft apt repo - { - curl -sSL ${MICROSOFT_GPG_KEYS_URI} - curl -sSL ${MICROSOFT_GPG_KEYS_ROLLING_URI} - } | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg - echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list + SUPPORTED_CODENAMES="${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" + UNSUPPORTED_HINT="either set feature option '\"moby\": false' or choose a compatible OS distribution" + RHEL_MESSAGE="RHEL-based system (${ID}) detected - Moby packages may require additional configuration" else - # Name of proprietary engine package - cli_package_name="docker-ce-cli" + SUPPORTED_CODENAMES="${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" + UNSUPPORTED_HINT="choose a compatible OS distribution" + RHEL_MESSAGE="RHEL-based system (${ID}) detected - using Docker CE packages" +fi + +case "${ADJUSTED_ID}" in + debian) + if [[ ! " ${SUPPORTED_CODENAMES} " != *"${VERSION_CODENAME}"* ]]; then + err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, ${UNSUPPORTED_HINT}." + err "Supported distributions include: ${SUPPORTED_CODENAMES}" + exit 1 + fi - # Import key safely and import Docker apt repo - curl -fsSL https://download.docker.com/linux/${ID}/gpg | gpg --dearmor > /usr/share/keyrings/docker-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/${ID} ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list + echo "Distro codename '${VERSION_CODENAME}' is supported." + ;; + rhel) + echo "${RHEL_MESSAGE}" + ;; +esac + +# Install base dependencies +case ${ADJUSTED_ID} in + debian) + check_packages apt-transport-https curl ca-certificates git gnupg2 dirmngr wget + ;; + rhel) + check_packages curl ca-certificates gnupg2 wget tar gawk git shadow-utils policycoreutils procps-ng + ;; +esac + +# Update CA certificates to ensure HTTPS connections work properly +# This is especially important for Ubuntu 24.04 (Noble) and Debian Trixie +# Only run for Debian-based systems (RHEL uses update-ca-trust instead) +if [ "${ADJUSTED_ID}" = "debian" ] && command -v update-ca-certificates > /dev/null 2>&1; then + update-ca-certificates fi -# Refresh apt lists -apt-get update +# Set up the necessary repos +if [ "${USE_MOBY}" = "true" ]; then + # Name of open source cli + cli_package_name="moby-cli" -# Soft version matching for CLI -if [ "${DOCKER_VERSION}" = "latest" ] || [ "${DOCKER_VERSION}" = "lts" ] || [ "${DOCKER_VERSION}" = "stable" ]; then - # Empty, meaning grab whatever "latest" is in apt repo - cli_version_suffix="" + case ${ADJUSTED_ID} in + debian) + # Import key safely and import Microsoft apt repo + { + curl -sSL ${MICROSOFT_GPG_KEYS_URI} + curl -sSL ${MICROSOFT_GPG_KEYS_ROLLING_URI} + } | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg + echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list + ;; + rhel) + err "Moby packages are not available for ${ID}. Please use 'moby': false option." + exit 1 + ;; + esac else - # Fetch a valid version from the apt-cache (eg: the Microsoft repo appends +azure, breakfix, etc...) - docker_version_dot_escaped="${DOCKER_VERSION//./\\.}" - docker_version_dot_plus_escaped="${docker_version_dot_escaped//+/\\+}" - # Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/ - docker_version_regex="^(.+:)?${docker_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" - set +e # Don't exit if finding version fails - will handle gracefully - cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" - set -e - if [ -z "${cli_version_suffix}" ] || [ "${cli_version_suffix}" = "=" ]; then - echo "(!) No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" - apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' - exit 1 - fi - echo "cli_version_suffix ${cli_version_suffix}" + # Name of proprietary cli package + cli_package_name="docker-ce-cli" + case ${ADJUSTED_ID} in + debian) + # Import key safely and import Docker apt repo + curl -fsSL https://download.docker.com/linux/${ID}/gpg | gpg --dearmor > /usr/share/keyrings/docker-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/${ID} ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list + ;; + rhel) + # Docker CE repository setup for RHEL-based systems + dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + ;; + esac fi +# Refresh package database +pkg_mgr_update + +# Soft version match for CLI +case "${DOCKER_VERSION}" in + latest|lts|stable) + cli_version_suffix="" + ;; + *) + case ${ADJUSTED_ID} in + debian) + # Fetch a valid version from the apt-cache (eg: the Microsoft repo appends +azure, breakfix, etc...) + docker_version_dot_escaped="${DOCKER_VERSION//./\\.}" + docker_version_dot_plus_escaped="${docker_version_dot_escaped//+/\\+}" + # Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/ + docker_version_regex="^(.+:)?${docker_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" + set +e # Don't exit if finding version fails - will handle gracefully + cli_version_suffix="=$(apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${docker_version_regex}")" + set -e + if [ -z "${cli_version_suffix}" ] || [ "${cli_version_suffix}" = "=" ]; then + echo "(!) No full or partial Docker / Moby version match found for \"${DOCKER_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" + apt-cache madison ${cli_package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' + exit 1 + fi + ;; + rhel) + # For RHEL-based systems, use dnf/yum to find versions + docker_version_escaped="${DOCKER_VERSION//./\\.}" + set +e # Don't exit if finding version fails - will handle gracefully + available_versions=$(${PKG_MGR_CMD} list --available ${cli_package_name} 2>/dev/null | grep -v "Available Packages" | awk '{print $2}' | grep -E "^${docker_version_escaped}" | head -1) + set -e + if [ -n "${available_versions}" ]; then + cli_version_suffix="-${available_versions}" + else + echo "(*) Exact version ${DOCKER_VERSION} not found, using latest available" + cli_version_suffix="" + fi + ;; + esac +esac +echo "cli_version_suffix ${cli_version_suffix}" + # Version matching for moby-buildx if [ "${USE_MOBY}" = "true" ]; then - if [ "${MOBY_BUILDX_VERSION}" = "latest" ]; then - # Empty, meaning grab whatever "latest" is in apt repo - buildx_version_suffix="" + case "${MOBY_BUILDX_VERSION}" in + latest) + buildx_version_suffix="" + ;; + *) + case ${ADJUSTED_ID} in + debian) + buildx_version_dot_escaped="${MOBY_BUILDX_VERSION//./\\.}" + buildx_version_dot_plus_escaped="${buildx_version_dot_escaped//+/\\+}" + buildx_version_regex="^(.+:)?${buildx_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" + set +e + buildx_version_suffix="=$(apt-cache madison moby-buildx | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${buildx_version_regex}")" + set -e + if [ -z "${buildx_version_suffix}" ] || [ "${buildx_version_suffix}" = "=" ]; then + err "No full or partial moby-buildx version match found for \"${MOBY_BUILDX_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" + apt-cache madison moby-buildx | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' + exit 1 + fi + ;; + rhel) + err "Moby packages are not available for ${ID}. Please use 'moby': false option." + exit 1 + ;; + esac + esac + echo "buildx_version_suffix ${buildx_version_suffix}" +fi + +# Install Docker / Moby CLI if not already installed +if type docker > /dev/null 2>&1; then + echo "Docker / Moby CLI already installed." +else + if [ "${USE_MOBY}" = "true" ]; then + case "${ADJUSTED_ID}" in + debian) + # Install Moby CLI + set +e + apt-get -y install --no-install-recommends \ + moby-cli${cli_version_suffix} \ + moby-buildx${buildx_version_suffix} + exit_code=$? + set -e + if [ ${exit_code} -ne 0 ]; then + err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-24.04')." + exit 1 + fi + # Install Compose + apt-get -y install --no-install-recommends moby-compose \ + || err "Package moby-compose (Docker Compose v2) is not available on ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + ;; + rhel) + err "Moby packages are not available for ${ID}. Please use 'moby': false option." + exit 1 + esac else - buildx_version_dot_escaped="${MOBY_BUILDX_VERSION//./\\.}" - buildx_version_dot_plus_escaped="${buildx_version_dot_escaped//+/\\+}" - buildx_version_regex="^(.+:)?${buildx_version_dot_plus_escaped}([\\.\\+ ~:-]|$)" - set +e - buildx_version_suffix="=$(apt-cache madison moby-buildx | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${buildx_version_regex}")" - set -e - if [ -z "${buildx_version_suffix}" ] || [ "${buildx_version_suffix}" = "=" ]; then - err "No full or partial moby-buildx version match found for \"${MOBY_BUILDX_VERSION}\" on OS ${ID} ${VERSION_CODENAME} (${architecture}). Available versions:" - apt-cache madison moby-buildx | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+' - exit 1 - fi - echo "buildx_version_suffix ${buildx_version_suffix}" + case "${ADJUSTED_ID}" in + debian) + # Install Docker CE CLI + apt-get -y install --no-install-recommends \ + docker-ce-cli${cli_version_suffix} + apt-mark hold docker-ce-cli + # Install Docker CE Compose + apt-get -y install --no-install-recommends docker-compose-plugin \ + || echo "(*) Package docker-compose-plugin (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + ;; + rhel) + ${PKG_MGR_CMD} -y install \ + docker-ce-cli${cli_version_suffix} \ + containerd.io + if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then + ${PKG_MGR_CMD} -y install docker-compose-plugin \ + || echo "(*) Package docker-compose-plugin not available for ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." + fi + ;; + esac fi fi - docker_home="/usr/libexec/docker" cli_plugins_dir="${docker_home}/cli-plugins" -install_compose_fallback(){ +# fallback for docker-compose +fallback_compose(){ local url=$1 local repo_url=$(get_github_api_repo_url "$url") echo -e "\n(!) Failed to fetch the latest artifacts for docker-compose v${compose_version}..." @@ -309,58 +467,21 @@ install_compose_fallback(){ curl -fsSL "https://github.com/docker/compose/releases/download/v${compose_version}/docker-compose-linux-${target_compose_arch}" -o ${docker_compose_path} } -# Install Docker / Moby CLI if not already installed -if type docker > /dev/null 2>&1; then - echo "Docker / Moby CLI already installed." -else - if [ "${USE_MOBY}" = "true" ]; then - buildx=() - if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then - buildx=(moby-buildx${buildx_version_suffix}) - fi - apt-get -y install --no-install-recommends ${cli_package_name}${cli_version_suffix} "${buildx[@]}" || { err "It seems packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-24.04')." ; exit 1 ; } - if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "v1" ]; then - apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping." - fi - else - buildx=() - if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then - buildx=(docker-buildx-plugin) - fi - #install cli + buildx first - apt-get -y install --no-install-recommends ${cli_package_name}${cli_version_suffix} "${buildx[@]}" - - # Backward compatibility: Older Docker CE versions bundled buildx with CLI - # Modern versions have separate packages, but this ensures consistent behavior - buildx_path="/usr/libexec/docker/cli-plugins/docker-buildx" - if [ "${INSTALL_DOCKER_BUILDX}" = "false" ] && [ -f "${buildx_path}" ]; then - echo "(*) Removing docker-buildx (bundled in older Docker CE) since installDockerBuildx is disabled..." - rm -f "${buildx_path}" - fi - - if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "v1" ]; then - apt-get -y install --no-install-recommends docker-compose-plugin - fi - fi - unset buildx buildx_path -fi # If 'docker-compose' command is to be included if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then case "${architecture}" in - amd64) target_compose_arch=x86_64 ;; - arm64) target_compose_arch=aarch64 ;; - *) - echo "(!) Docker outside of docker does not support machine architecture '$architecture'. Please use an x86-64 or ARM64 machine." - exit 1 + amd64|x86_64) target_compose_arch=x86_64 ;; + arm64|aarch64) target_compose_arch=aarch64 ;; + *) + echo "(!) Docker in docker does not support machine architecture '$architecture'. Please use an x86-64 or ARM64 machine." + exit 1 esac - docker_compose_path="/usr/local/bin/docker-compose" - # Install Docker Compose if not already installed and is on a supported architecture - if type docker-compose > /dev/null 2>&1; then - echo "Docker Compose already installed." - elif [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then + + docker_compose_path="/usr/local/bin/docker-compose" + if [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then err "The final Compose V1 release, version 1.29.2, was May 10, 2021. These packages haven't received any security updates since then. Use at your own risk." INSTALL_DOCKER_COMPOSE_SWITCH="false" - + if [ "${target_compose_arch}" = "x86_64" ]; then echo "(*) Installing docker compose v1..." curl -fsSL "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64" -o ${docker_compose_path} @@ -374,11 +495,21 @@ if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then err "Docker compose v1 is unavailable for 'bookworm' on Arm64. Kindly switch to use v2" exit 1 else - # Use pip to get a version that runs on this architecture + # Use pip (inside an isolated venv) to get a version that runs on this architecture. + # A dedicated venv avoids PEP 668 "externally-managed-environment" errors on newer + # distros (Debian trixie, Ubuntu noble, etc.) and guarantees we do not modify or + # shadow the distro-managed system Python site-packages. check_packages python3-minimal python3-pip libffi-dev python3-venv - echo "(*) Installing docker compose v1 via pip..." - export PYTHONUSERBASE=/usr/local - pip3 install --disable-pip-version-check --no-cache-dir --user "Cython<3.0" pyyaml wheel docker-compose --no-build-isolation + echo "(*) Installing docker compose v1 via pip into an isolated virtualenv..." + + compose_v1_venv="/usr/local/share/docker-compose-v1-venv" + python3 -m venv "${compose_v1_venv}" + "${compose_v1_venv}/bin/pip" install --disable-pip-version-check --no-cache-dir --upgrade pip setuptools wheel + "${compose_v1_venv}/bin/pip" install --disable-pip-version-check --no-cache-dir "Cython<3.0" pyyaml docker-compose --no-build-isolation + + # Expose the venv's docker-compose entrypoint on PATH at the expected location. + ln -sf "${compose_v1_venv}/bin/docker-compose" "${docker_compose_path}" + chmod +x "${docker_compose_path}" fi else compose_version=${DOCKER_DASH_COMPOSE_VERSION#v} @@ -386,8 +517,10 @@ if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then find_version_from_git_tags compose_version "$docker_compose_url" "tags/v" echo "(*) Installing docker-compose ${compose_version}..." curl -fsSL "https://github.com/docker/compose/releases/download/v${compose_version}/docker-compose-linux-${target_compose_arch}" -o ${docker_compose_path} || { - install_compose_fallback "$docker_compose_url" "$compose_version" "$target_compose_arch" "$docker_compose_path" + echo -e "\n(!) Failed to fetch the latest artifacts for docker-compose v${compose_version}..." + fallback_compose "$docker_compose_url" } + chmod +x ${docker_compose_path} # Download the SHA256 checksum @@ -400,16 +533,40 @@ if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then fi fi +# fallback method for compose-switch +fallback_compose-switch() { + local url=$1 + local repo_url=$(get_github_api_repo_url "$url") + echo -e "\n(!) Failed to fetch the latest artifacts for compose-switch v${compose_switch_version}..." + get_previous_version "$url" "$repo_url" compose_switch_version + echo -e "\nAttempting to install v${compose_switch_version}" + curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${target_switch_arch}" -o /usr/local/bin/compose-switch +} + # Install docker-compose switch if not already installed - https://github.com/docker/compose-switch#manual-installation if [ "${INSTALL_DOCKER_COMPOSE_SWITCH}" = "true" ] && ! type compose-switch > /dev/null 2>&1; then if type docker-compose > /dev/null 2>&1; then echo "(*) Installing compose-switch..." - current_compose_path="$(which docker-compose)" + current_compose_path="$(command -v docker-compose)" target_compose_path="$(dirname "${current_compose_path}")/docker-compose-v1" compose_switch_version="latest" compose_switch_url="https://github.com/docker/compose-switch" - find_version_from_git_tags compose_switch_version "${compose_switch_url}" - curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${architecture}" -o /usr/local/bin/compose-switch || install_compose_switch_fallback "${compose_switch_url}" + # Try to get latest version, fallback to known stable version if GitHub API fails + set +e + find_version_from_git_tags compose_switch_version "$compose_switch_url" + if [ $? -ne 0 ] || [ -z "${compose_switch_version}" ] || [ "${compose_switch_version}" = "latest" ]; then + echo "(*) GitHub API rate limited or failed, using fallback method" + fallback_compose-switch "$compose_switch_url" + fi + set -e + + # Map architecture for compose-switch downloads + case "${architecture}" in + amd64|x86_64) target_switch_arch=amd64 ;; + arm64|aarch64) target_switch_arch=arm64 ;; + *) target_switch_arch=${architecture} ;; + esac + curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${target_switch_arch}" -o /usr/local/bin/compose-switch || fallback_compose-switch "$compose_switch_url" chmod +x /usr/local/bin/compose-switch # TODO: Verify checksum once available: https://github.com/docker/compose-switch/issues/11 # Setup v1 CLI as alternative in addition to compose-switch (which maps to v2) From 953f8a12a2fa3a4c54173eb5fc114c568e185c6b Mon Sep 17 00:00:00 2001 From: AwlsomeAlex Date: Sun, 28 Jun 2026 18:12:35 -0400 Subject: [PATCH 2/2] fixup! feat(DooD): Enterprise Linux and Fedora support --- src/docker-outside-of-docker/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docker-outside-of-docker/install.sh b/src/docker-outside-of-docker/install.sh index 514790dc6..ad1f5fa13 100755 --- a/src/docker-outside-of-docker/install.sh +++ b/src/docker-outside-of-docker/install.sh @@ -267,7 +267,7 @@ fi case "${ADJUSTED_ID}" in debian) - if [[ ! " ${SUPPORTED_CODENAMES} " != *"${VERSION_CODENAME}"* ]]; then + if [[ " ${SUPPORTED_CODENAMES} " != *"${VERSION_CODENAME}"* ]]; then err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, ${UNSUPPORTED_HINT}." err "Supported distributions include: ${SUPPORTED_CODENAMES}" exit 1