Skip to content

Commit 60d16d6

Browse files
test
1 parent bd5d472 commit 60d16d6

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

src/docker-in-docker/install.sh

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -410,25 +410,25 @@ EOF
410410
# Install device-mapper libraries (critical for Docker CE)
411411
echo "(*) Installing device-mapper libraries for Docker CE..."
412412
${PKG_MGR_CMD} -y install device-mapper-libs || {
413-
echo "(*) Trying alternative device-mapper package names..."
414-
${PKG_MGR_CMD} -y install lvm2-libs || {
415-
echo "(*) ERROR: Could not install device-mapper libraries"
416-
echo "(*) Docker CE requires libdevmapper.so.1.02 to function"
417-
exit 1
418-
}
419-
}
420-
421-
# Install other essential libraries for Docker CE
422-
echo "(*) Installing additional Docker CE dependencies..."
423-
${PKG_MGR_CMD} -y install \
424-
libseccomp \
425-
libtool-ltdl \
426-
systemd-libs \
427-
libcgroup \
428-
tar \
429-
xz || {
430-
echo "(*) Some optional dependencies could not be installed, continuing..."
431-
}
413+
echo "(*) Trying alternative device-mapper package names..."
414+
${PKG_MGR_CMD} -y install lvm2-libs || {
415+
echo "(*) ERROR: Could not install device-mapper libraries"
416+
echo "(*) Docker CE requires libdevmapper.so.1.02 to function"
417+
exit 1
418+
}
419+
}
420+
421+
# Install other essential libraries for Docker CE
422+
echo "(*) Installing additional Docker CE dependencies..."
423+
${PKG_MGR_CMD} -y install \
424+
libseccomp \
425+
libtool-ltdl \
426+
systemd-libs \
427+
libcgroup \
428+
tar \
429+
xz || {
430+
echo "(*) Some optional dependencies could not be installed, continuing..."
431+
}
432432

433433
# For Azure Linux, install Docker CE without container-selinux complexity
434434
if [ "${USE_MOBY}" != "true" ]; then
@@ -770,7 +770,6 @@ fallback_compose-switch() {
770770
echo -e "\nAttempting to install v${compose_switch_version}"
771771
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
772772
}
773-
774773
# Install docker-compose switch if not already installed - https://github.com/docker/compose-switch#manual-installation
775774
if [ "${INSTALL_DOCKER_COMPOSE_SWITCH}" = "true" ] && ! type compose-switch > /dev/null 2>&1; then
776775
if type docker-compose > /dev/null 2>&1; then
@@ -779,14 +778,22 @@ if [ "${INSTALL_DOCKER_COMPOSE_SWITCH}" = "true" ] && ! type compose-switch > /d
779778
target_compose_path="$(dirname "${current_compose_path}")/docker-compose-v1"
780779
compose_switch_version="latest"
781780
compose_switch_url="https://github.com/docker/compose-switch"
781+
# Try to get latest version, fallback to known stable version if GitHub API fails
782+
set +e
782783
find_version_from_git_tags compose_switch_version "$compose_switch_url"
784+
if [ $? -ne 0 ] || [ -z "${compose_switch_version}" ] || [ "${compose_switch_version}" = "latest" ]; then
785+
echo "(*) GitHub API rate limited or failed, using fallback version 1.0.5"
786+
compose_switch_version="1.0.5"
787+
fi
788+
set -e
789+
783790
# Map architecture for compose-switch downloads
784791
case "${architecture}" in
785792
amd64|x86_64) target_switch_arch=amd64 ;;
786793
arm64|aarch64) target_switch_arch=arm64 ;;
787794
*) target_switch_arch=${architecture} ;;
788795
esac
789-
curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${architecture}" -o /usr/local/bin/compose-switch || fallback_compose-switch "$compose_switch_url"
796+
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"
790797
chmod +x /usr/local/bin/compose-switch
791798
# TODO: Verify checksum once available: https://github.com/docker/compose-switch/issues/11
792799
# Setup v1 CLI as alternative in addition to compose-switch (which maps to v2)

0 commit comments

Comments
 (0)