From 09cda5f197055d1268177119d9448282aa3f48a1 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 2 Mar 2026 06:20:30 +0000 Subject: [PATCH] feat: support DinD install for Amazon Linux 2023 Signed-off-by: Giles Cope --- utils/dind/install-dind.sh | 37 +++++++++++++++++++++++++++++++++++-- utils/dind/tests/Earthfile | 3 ++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/utils/dind/install-dind.sh b/utils/dind/install-dind.sh index d5e6238..d9d06c1 100755 --- a/utils/dind/install-dind.sh +++ b/utils/dind/install-dind.sh @@ -117,6 +117,10 @@ install_dockerd_amazon() { yes | amazon-linux-extras install docker ;; + 2023*) + dnf -y install docker + ;; + *) # Amazon Linux 1 uses versions like "2018.3" here, so dont bother enumerating yum -y install docker ;; @@ -130,7 +134,7 @@ install_jq() { ;; amzn) - yum -y install jq + install_jq_amazon ;; *) @@ -141,6 +145,19 @@ install_jq() { esac } +install_jq_amazon() { + version=$(sed -n -e 's/^VERSION="\?\([^\"]*\)"\?/\1/p' /etc/os-release) + case "$version" in + 2023*) + dnf -y install jq + ;; + + *) + yum -y install jq + ;; + esac +} + clean_after_install_debian_like() { if [ "$apt_update_done" = "true" ]; then echo "Cleaning apt after installs" @@ -149,11 +166,27 @@ clean_after_install_debian_like() { fi } +clean_after_install_amazon() { + version=$(sed -n -e 's/^VERSION="\?\([^\"]*\)"\?/\1/p' /etc/os-release) + case "$version" in + 2023*) + dnf clean all + ;; + + *) + # nothing to clean + ;; + esac +} + clean_after_install() { case "$distro" in - alpine | amzn) + alpine) # nothing to clean ;; + amzn) + clean_after_install_amazon + ;; *) clean_after_install_debian_like ;; diff --git a/utils/dind/tests/Earthfile b/utils/dind/tests/Earthfile index a207ce7..f3b7acb 100644 --- a/utils/dind/tests/Earthfile +++ b/utils/dind/tests/Earthfile @@ -10,6 +10,7 @@ all: --base_image=ubuntu:latest \ --base_image=amazonlinux:1 \ --base_image=amazonlinux:2 \ + --base_image=amazonlinux:2023 \ --base_image=earthly/dind:alpine \ --base_image=earthly/dind:ubuntu @@ -17,7 +18,7 @@ test-install-dind-for-image: ARG --required base_image FROM alpine ARG TARGETPLATFORM - IF [ "${base_image%:*}" = "amazonlinux" ] && [ "$TARGETPLATFORM" = "linux/arm64" ] # no amazonlinux:1 for arm64/function not supported atm for amazonlinux:2 on arm - skipping + IF [ "${base_image}" = "amazonlinux:1" -o "${base_image}" = "amazonlinux:2" ] && [ "$TARGETPLATFORM" = "linux/arm64" ] # no amazonlinux:1 for arm64/function not supported atm for amazonlinux:2 on arm - skipping RUN echo skipping $base_image with platform $TARGETPLATFORM ELSE FROM "$base_image"