You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue when using rules_docker in a different architecture (in my case ppc64le) where all the container images generated get the label as amd64 architecture despite the architecture I am running in.
Steps to recreate
Need a system from a different architecture than amd64.
$ docker run -it index.docker.io/murilofv/fedora30:latest bash
[root@8a0ecb4ef47d /]# exit
Aside from being confusing to an user, labeling it incorrectly would be an issue if this container image would be made a part of manifest list to build a multi-arch image.
Potential fix
I did a small patch that seemed to have done the trick for me but I don't know if it is the proper way to address this issue, so I'd appreciate any feedback / suggestions on how to address it. The following is the patch:
Basically I am only changing the hardcoded amd64 label in container/go/pkg/compat/config.go by the runtime GOARCH value. If this is an acceptable / proper way I can do a PR for it.
With it I get the proper architecture label and can execute in my system without any issues as well:
I think the suggested fix would tie the architecture of the built image to the platform it was built on. I feel like that's not the right approach. Let me know if you disagree.
I'm thinking maybe we should expose the architecture as an attribute on the container_image rule that would default to amd64 but can be overridden by the user. If you have multiple images that want to override the architecture attribute, you could then define a custom container_image macro that sets the new attribute but forwards other attributes to the underlying container_image rule exported by rules_docker. If this proposal sounds agreeable, feel free to send a PR and I'll be happy to review!
I have an issue when using rules_docker in a different architecture (in my case ppc64le) where all the container images generated get the label as amd64 architecture despite the architecture I am running in.
Steps to recreate
Need a system from a different architecture than amd64.
The following is an example of a
WORKSPACE
file:Note: I am using a custom rebuilt
puller
binary given it is currently only built for amd64The following is an example of the
BUILD.bazel
file:Run the following commands:
bazel build :fedora30_ppc64le
bazel run :push-fedora30_ppc64le
By inspecting it we can see that the architecture doesn't match what it was built in:
The image works fine though:
Aside from being confusing to an user, labeling it incorrectly would be an issue if this container image would be made a part of manifest list to build a multi-arch image.
Potential fix
I did a small patch that seemed to have done the trick for me but I don't know if it is the proper way to address this issue, so I'd appreciate any feedback / suggestions on how to address it. The following is the patch:
container_proper_arch.txt
Basically I am only changing the hardcoded amd64 label in
container/go/pkg/compat/config.go
by the runtime GOARCH value. If this is an acceptable / proper way I can do a PR for it.With it I get the proper architecture label and can execute in my system without any issues as well:
I put the patched / unpatched container images built in this test in my docker hub: https://hub.docker.com/r/murilofv/fedora30/tags
The text was updated successfully, but these errors were encountered: