Skip to content

Changed dockerfile to work on multi *nix platforms#1569

Open
TheeNawMan wants to merge 1 commit intoNVIDIA:developfrom
TheeNawMan:develop
Open

Changed dockerfile to work on multi *nix platforms#1569
TheeNawMan wants to merge 1 commit intoNVIDIA:developfrom
TheeNawMan:develop

Conversation

@TheeNawMan
Copy link

@TheeNawMan TheeNawMan commented Feb 5, 2026

Description

Changed dockerfile to work on multi *nix platforms

Tested on MacBook M1, MacBook Pro M4, DGX-SPARK, and Debian 13.3.0 x86

Label: enhancement

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Summary by CodeRabbit

  • Chores
    • Updated Docker build architecture detection mechanism to improve compatibility and reliability for cross-architecture container builds.

Signed-off-by: Joshua Nauman <carnage_auction.2i@icloud.com>
@copy-pr-bot
Copy link

copy-pr-bot bot commented Feb 5, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

The HOST_ARCH detection method in the build container script was changed from dpkg --print-architecture to uname -m, which alters how the host architecture is determined for cross-build operations. No other logic changes were made.

Changes

Cohort / File(s) Summary
Architecture Detection
docker/build_container.sh
Replaced HOST_ARCH detection method from dpkg --print-architecture to uname -m. This changes the mechanism for determining host architecture in cross-build scenarios.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change in the pull request - modifying the build script to support multiple Unix-like platforms by replacing architecture detection method.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@TheeNawMan TheeNawMan marked this pull request as ready for review February 5, 2026 03:14
@TheeNawMan TheeNawMan requested a review from a team as a code owner February 5, 2026 03:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docker/build_container.sh`:
- Around line 24-25: The script sets HOST_ARCH from uname -m and uses
DOCKER_TARGET_ARCH from it, but Docker --platform requires normalized names;
update the assignment logic for HOST_ARCH/DOCKER_TARGET_ARCH to map raw uname -m
outputs to Docker-compatible values (e.g., map x86_64 -> amd64, aarch64 ->
arm64, arm64 -> arm64, i386 -> 386, armv7l -> arm/v7, etc.) so the --platform
flag (used later) receives a valid architecture; implement a small mapping block
that reads HOST_ARCH=$(uname -m) and then sets
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-<mapped-value>} based on those cases.

Comment on lines +24 to 25
HOST_ARCH=$(uname -m)
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Architecture naming mismatch will break Docker builds on Linux systems.

uname -m returns raw kernel architecture names (x86_64, aarch64) while Docker's --platform flag on line 40 expects normalized names (amd64, arm64). This will cause builds to fail on x86_64 and ARM64 Linux systems with an invalid platform error.

A mapping is needed to translate uname -m output to Docker-compatible architecture names.

🐛 Proposed fix with architecture mapping
-HOST_ARCH=$(uname -m)
+# Map uname output to Docker platform architecture names
+case $(uname -m) in
+    x86_64)  HOST_ARCH="amd64" ;;
+    aarch64) HOST_ARCH="arm64" ;;
+    arm64)   HOST_ARCH="arm64" ;;
+    *)       HOST_ARCH=$(uname -m) ;;
+esac
 DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
HOST_ARCH=$(uname -m)
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
# Map uname output to Docker platform architecture names
case $(uname -m) in
x86_64) HOST_ARCH="amd64" ;;
aarch64) HOST_ARCH="arm64" ;;
arm64) HOST_ARCH="arm64" ;;
*) HOST_ARCH=$(uname -m) ;;
esac
DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-${HOST_ARCH}}
🤖 Prompt for AI Agents
In `@docker/build_container.sh` around lines 24 - 25, The script sets HOST_ARCH
from uname -m and uses DOCKER_TARGET_ARCH from it, but Docker --platform
requires normalized names; update the assignment logic for
HOST_ARCH/DOCKER_TARGET_ARCH to map raw uname -m outputs to Docker-compatible
values (e.g., map x86_64 -> amd64, aarch64 -> arm64, arm64 -> arm64, i386 ->
386, armv7l -> arm/v7, etc.) so the --platform flag (used later) receives a
valid architecture; implement a small mapping block that reads HOST_ARCH=$(uname
-m) and then sets DOCKER_TARGET_ARCH=${DOCKER_TARGET_ARCH:-<mapped-value>} based
on those cases.

Copy link
Member

@willkill07 willkill07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coderabbit's feedback is meaningful and would need to be addressed.

uname -m is not suitable

@willkill07 willkill07 self-assigned this Feb 5, 2026
@willkill07 willkill07 added improvement Improvement to existing functionality non-breaking Non-breaking change labels Feb 5, 2026
@willkill07
Copy link
Member

@TheeNawMan I want to clarify my justification:

macOS w/ Podman

$ podman buildx inspect --bootstrap
Name:   default
Driver: podman

Nodes:
Name:             default
Endpoint:         default
Status:           running
Buildkit version: N/A
Platforms:        linux/arm64, linux/386, linux/amd64, linux/arm64be
...

Linux w/ Docker

$ docker buildx inspect --bootstrap
Name:   default
Driver: docker

Nodes:
Name:             default
Endpoint:         default
Status:           running
BuildKit version: v0.0.0+unknown
Platforms:        linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4
...

Notice how platform definitions are strict and do not match uname -m output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement to existing functionality non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants