Replace uname -m with rpm --query for userspace arch detection#274
Merged
mmm-choi merged 1 commit intocorretto:mainfrom Apr 3, 2026
Merged
Replace uname -m with rpm --query for userspace arch detection#274mmm-choi merged 1 commit intocorretto:mainfrom
mmm-choi merged 1 commit intocorretto:mainfrom
Conversation
Replace $(uname -m) with rpm --query --queryformat='%{ARCH}' rpm in all
AL2 and AL2023 Dockerfiles. This queries the actual userspace architecture
instead of the kernel architecture, which is more correct for RPM-based
images.
The architecture value is captured in an ARCH variable early in the RUN
command chain (after set -eux), ensuring proper error propagation. All
subsequent uses reference ${ARCH} instead of inline $(uname -m) subshells.
Addresses feedback from docker-library maintainer on PR #21053.
Files changed: 24 Dockerfiles across Corretto 8, 11, 17, 21, 25, 26
(all AL2 and AL2023 variants: jdk, jre, headful, headless)
Not modified: Alpine, Debian, al2-generic, and slim Dockerfiles
(these use package managers, not direct RPM downloads)
cost0much
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace
$(uname -m)withrpm --query --queryformat='%{ARCH}' rpmin all AL2 and AL2023 Dockerfiles.Motivation
Addresses feedback from @tianon on PR #21053:
uname -mreports kernel architecture, which doesn't necessarily match the userspace architecture. Usingrpm --queryqueries the actual userspace architecture, which is more correct for RPM-based images.Capture architecture in a variable before use — inline
$(uname -m)subshells can swallow errors. CapturingARCHearly in the&&chain ensures proper error propagation underset -eux.Changes
ARCH="$(rpm --query --queryformat='%{ARCH}' rpm)"early in theRUNcommand chain (right afterset -eux)$(uname -m)occurrences with${ARCH}Not Modified
apk add, nouname -m)apt-get, nouname -m)yum installfrom repo, no direct RPM downloads)Testing
java -versionon AL2 (11/jdk/al2) and AL2023 (17/jdk/al2023, 8/jre/al2023) imagesuname -min any AL2/AL2023 Dockerfile