Skip to content

fix(docker): build the arm64 image with an arm64 userland - #2932

Merged
Erik Osterman (Cloud Posse) (osterman) merged 5 commits into
cloudposse:mainfrom
arcaven:fix/docker-arm64-userland
Aug 18, 2026
Merged

Erik Osterman (Cloud Posse) (osterman) merged 5 commits into
cloudposse:mainfrom
arcaven:fix/docker-arm64-userland

Conversation

@arcaven

@arcaven Michael Pursifull (arcaven) commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

This makes the linux/arm64 image you already publish run on arm64 hardware,
instead of failing at startup with exec format error. The arm64 image has
shipped an amd64 userland since it was first added, so this closes the gap between
the advertised multi-arch manifest and what arm64 users actually receive. The
change is one line and additive, plus a guard so it cannot silently regress.

what

  • Drop the --platform=$BUILDPLATFORM pin on the runtime FROM so the Debian
    base and all apt-installed tools follow TARGETPLATFORM.
  • Add a build-time assertion that the base architecture matches the build
    target, so a re-introduced pin fails the build instead of shipping a
    wrong-arch image.

why

  • The pinned base meant every target built on an amd64 base, so the published
    linux/arm64 image contained an amd64 userland and failed with
    exec format error on arm64 hardware. Only atmos and kustomize were
    arm64, and they were stranded in an amd64 rootfs with no aarch64 loader.
  • This has been the case since the image was first added (Add docker image #627), so no released
    tag has a working arm64 image. The guard would have caught this on day one.

references

The runtime FROM was pinned to $BUILDPLATFORM, so for every target the
Debian base and all apt-installed tools resolved to the build host arch
(amd64). The published linux/arm64 image shipped an amd64 userland and
failed with `exec format error` on arm64 hardware. Drop the override so
the base follows TARGETPLATFORM, and assert the base arch matches the
target so this cannot silently regress.
@arcaven
Michael Pursifull (arcaven) requested a review from a team as a code owner August 13, 2026 10:12
@atmos-pro

atmos-pro Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-actions github-actions Bot added the size/xs Extra small size PR label Aug 13, 2026
@mergify

mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1fe4787b-72e5-43b4-8765-b1cf36e5fae6

📥 Commits

Reviewing files that changed from the base of the PR and between b63923f and c5da685.

📒 Files selected for processing (1)
  • Dockerfile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The Dockerfile now follows the requested target platform for the Debian base image. It declares TARGETARCH and TARGETOS and validates the userland architecture during the build.

Changes

Docker Platform Alignment

Layer / File(s) Summary
Base image and architecture validation
Dockerfile
The base image no longer forces $BUILDPLATFORM. The Dockerfile declares TARGETARCH and TARGETOS, then aborts when dpkg reports an architecture that does not match the target.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c5da6

The PR makes the arm64 image use an arm64 userland and adds a build-time guard against regression. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The Dockerfile changes address [#2931] by following TARGETPLATFORM and asserting that the base architecture matches the target.
Out of Scope Changes check ✅ Passed All changes support the linked issue by correcting the runtime architecture and preventing future mismatches.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main Docker change: building the arm64 image with an arm64 userland.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 13, 2026
@github-actions github-actions Bot added size/s Small size PR and removed size/xs Extra small size PR labels Aug 13, 2026
@osterman

Copy link
Copy Markdown
Member

CodeRabbit (@coderabbitai) is this the correct fix? my concern is we're removing --platform=$BUILDPLATFORM debian:trixie-slim which was specifically for this purpose.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

dockerfile=$(fd -t f -a '^Dockerfile$|\.Dockerfile$' . | head -n 1)
if [ -z "${dockerfile:-}" ]; then
  echo "No Dockerfile found"
  exit 0
fi

echo "== Dockerfile: $dockerfile =="
ast-grep outline "$dockerfile" --items all --view expanded || true

echo "== PR diff =="
git diff --find-renames origin/HEAD...HEAD -- "$dockerfile" || \
git diff --find-renames HEAD^...HEAD -- "$dockerfile"

echo "== Full Dockerfile (numbered) =="
cat -n "$dockerfile"

Length of output: 5429


@osterman Yes. This is the correct fix for this Dockerfile.

--platform=$BUILDPLATFORM makes debian:trixie-slim match the machine that performs the build. If the builder is amd64 and the requested image is linux/arm64, the stage gets an amd64 Debian userland. That includes /bin/sh, tail, apt, and every package installed with apt-get.

The Dockerfile then downloads some binaries for TARGETPLATFORM. This produces a mixed-architecture image. That matches the exec format error in #2931.

This stage is the published runtime stage. It must use the target platform:

FROM debian:trixie-slim

With Buildx, an unpinned FROM resolves the base image for TARGETPLATFORM. TARGETARCH is then arm64, and dpkg --print-architecture returns arm64 in the expected Debian arm64 image. The new assertion prevents a future platform pin from silently reintroducing the mismatch.

--platform=$BUILDPLATFORM is still correct for a separate build stage that compiles native build tools. Such a stage must copy only target-compatible output into a final TARGETPLATFORM runtime stage. This Dockerfile has no such build stage.

The only operational requirement is standard Buildx emulation when an amd64 builder executes RUN instructions for arm64. The existing image already executes target-specific install steps, so that requirement is inherent to the multi-platform build.


🧠 Learnings used
Learnt from: osterman
Repo: cloudposse/atmos PR: 2899
File: website/blog/2026-08-06-toolchain-lockfile-default.mdx:0-0
Timestamp: 2026-08-07T03:33:30.401Z
Learning: Atmos toolchain lockfiles pin resolved artifacts per operating system and architecture. The same declared tool version can resolve to different artifacts on different platforms, so reproducibility documentation must scope identical-artifact claims to repeated installs on the same platform.

You are interacting with an AI system.

@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.29%. Comparing base (b63923f) to head (c5da685).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2932      +/-   ##
==========================================
- Coverage   83.29%   83.29%   -0.01%     
==========================================
  Files        1898     1898              
  Lines      185057   185057              
==========================================
- Hits       154148   154134      -14     
- Misses      23064    23072       +8     
- Partials     7845     7851       +6     
Flag Coverage Δ
unittests 83.29% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arcaven

Copy link
Copy Markdown
Contributor Author

Erik Osterman (Cloud Posse) (@osterman) there's also some test opportunities here, see #2936 (would benefit by being run a few times, this was my blind fix)

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@atmos-pro

atmos-pro Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@atmos-pro

atmos-pro Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

Merged via the queue into cloudposse:main with commit af3514c Aug 18, 2026
154 checks passed
@atmos-pro

atmos-pro Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Aug 18, 2026
@github-actions

Copy link
Copy Markdown

These changes were released in v1.226.0-test.9.

Igor Rodionov (goruha) added a commit that referenced this pull request Aug 18, 2026
…into 1199-pro-exec-metadata

* '1199-pro-exec-metadata' of github.com:cloudposse/atmos:
  chore: upgrade actions to Node 24 runtime (SHA-pinned) (#2934)
  fix(docker): build the arm64 image with an arm64 userland (#2932)
  feat(profiles): interactive multi-select for bare --profile (#2951)
  fix(git): tolerate config errors for CI git-clone bootstrap pre-Cobra (#2879)
  feat(vendor): add --stack/--labels flags, fix --tags selector bugs (#1889)
  feat(scaffold): dynamic per-combination file generation via matrix (#2928)
  feat(auth): add GKE kubeconfig integration (#2937)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/s Small size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Published linux/arm64 Docker image contains an amd64 userland (every base binary fails exec format error on arm64 hardware)

2 participants