Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide binaries compatible with $(uname -m) #92

Closed
fauust opened this issue Sep 24, 2021 · 3 comments
Closed

Provide binaries compatible with $(uname -m) #92

fauust opened this issue Sep 24, 2021 · 3 comments

Comments

@fauust
Copy link

fauust commented Sep 24, 2021

Hi!
gosu is not available as package on some distribution, RHEL7/8 for instance.

Would you consider providing the binary in a compatible way with uname -m, or maybe provide an example on how to pull the binary on non-debian OS (where dpkg is not available)?

For instance dumb-init project that is widely used in Docker context provide them with a different naming and the following works and is pretty standard on Linux to determine architecture:
curl -sL "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_$(uname -m)" >/usr/local/bin/dumb-init

Of course this should be a non-breaking change for people already relaying on the actual naming, I am not sure if GitHub provide something for that. So maybe documenting somewhere how to pull it form GH on non-debian OS is a good first step.

Cheers!

@fauust
Copy link
Author

fauust commented Sep 24, 2021

Note that for ppc64le it's already ok (and maybe for other arch). Problem concerns amd64 and arm64 so far.

@yosifkit
Copy link
Collaborator

Just make a case statement in your Dockerfile to translate uname output into the dkpg value? Similar to how the golang images translate the dpkg architecture to the provided upstream files (https://github.com/docker-library/golang/blob/master/1.17/bullseye/Dockerfile#L26-L60).


Using uname -m or arch for platform detection is not always reliable, as it gets the host kernel's architecture, when what you really need to get was the image's userspace architecture. If you are building an arm32v7 image on an arm64v8 host using the proper setarch, you will get armv8l instead of the correct armv6l value (uncertain on the exact values here). See docker-library/official-images#10907 (comment) for more info.

@fauust
Copy link
Author

fauust commented Sep 26, 2021

Just make a case statement in your Dockerfile to translate uname output into the dkpg value? Similar to how the golang images translate the dpkg architecture to the provided upstream files (https://github.com/docker-library/golang/blob/master/1.17/bullseye/Dockerfile#L26-L60).

Yes, this is what I end up doing. But it seems still a lot of code duplication to me since I am not using any templating system for my Dockerfiles (maybe I should consider it though).

Using uname -m or arch for platform detection is not always reliable, as it gets the host kernel's architecture, when what you really need to get was the image's userspace architecture. If you are building an arm32v7 image on an arm64v8 host using the proper setarch, you will get armv8l instead of the correct armv6l value (uncertain on the exact values here). See docker-library/official-images#10907 (comment) for more info.

Interesting, thank you! I guess I should try to find a rhel alternative to dpkg --print-architecture then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants