Skip to content

Commit 9ec803c

Browse files
committed
Fix install-docker.sh to support ARM64 architecture
The script was hardcoded to download x86_64 Docker binaries, causing "Exec format error" on ARM64 runners. This commit adds architecture detection to download the appropriate binaries for both amd64 and arm64. Changes: - Add architecture detection using uname -m - Map system architecture to Docker download paths (x86_64/aarch64) - Map architecture to buildx binary names (amd64/arm64) - Add informative echo to show detected architecture - Add error handling for unsupported architectures This fix is required for ARM64 integration tests to run successfully. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
1 parent 64bceac commit 9ec803c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/scripts/install-docker.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,30 @@
22

33
set -x
44
VER="28.0.4"
5-
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
5+
6+
# Detect architecture
7+
ARCH=$(uname -m)
8+
case $ARCH in
9+
x86_64)
10+
DOCKER_ARCH="x86_64"
11+
BUILDX_ARCH="amd64"
12+
;;
13+
aarch64)
14+
DOCKER_ARCH="aarch64"
15+
BUILDX_ARCH="arm64"
16+
;;
17+
*)
18+
echo "Unsupported architecture: $ARCH"
19+
exit 1
20+
;;
21+
esac
22+
23+
echo "Installing Docker $VER for architecture: $ARCH (docker: $DOCKER_ARCH, buildx: $BUILDX_ARCH)"
24+
25+
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/$DOCKER_ARCH/docker-$VER.tgz
626
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
727
mkdir -vp ~/.docker/cli-plugins/
8-
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
28+
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-$BUILDX_ARCH" > ~/.docker/cli-plugins/docker-buildx
929
chmod a+x ~/.docker/cli-plugins/docker-buildx
1030
mv /tmp/docker/* /usr/bin
1131
docker run --privileged --rm tonistiigi/binfmt --install all

0 commit comments

Comments
 (0)