-
Notifications
You must be signed in to change notification settings - Fork 143
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
balena build / deploy --build selects base image of wrong architecture (multiarch image manifest) #1508
Comments
Related to issue cloud builder should understand and use the docker hub manifest files (private repo) |
[pdcastro] This issue has attached support thread https://jel.ly.fish/#/support-thread~d0b11b4d-1ff9-45fa-855a-453d612ff58a |
@pdcastro The builder within BalenaOS does not understand The result is that I cannot work with both the Local and Cloud methods in mind, I can only pick and choose one. This is a bit of a show-stopper for the project I'm working on. |
@richbayliss This is the issue I referenced tonight at IoT Liverpool. |
This is the single most annoying issue I have encountered with Balena, that if resolved would make my day and allow me to get on with things. Is there a timeline for when Docker Hub manifests will be supported? |
The easiest way to fix this, for now, would be to change these variables to match the Docker Hub manifest rather than some arbitrary string. For example, why is Raspberry Pi 1 https://www.balena.io/docs/learn/develop/dockerfile/
|
I've come across the following dependency ( balena CLI is currently at |
[pdcastro] This issue has attached support thread https://jel.ly.fish/ae60add5-3450-4fd0-8f5b-9194875b2919 |
[pdcastro] This issue has attached support thread https://jel.ly.fish/73473ac9-0b86-4f3c-a950-279c6ebf9753 |
[pdcastro] This issue has attached support thread https://jel.ly.fish/3f656584-1da5-4b5b-afb2-d49294e2e38c |
[pdcastro] This issue has attached support thread https://jel.ly.fish/8364ae96-2b05-425c-aff3-c3058cf98f3c |
[rahul-thakoor] This issue has attached support thread https://jel.ly.fish/f0910369-0b58-48f3-9214-1e6fe0d16388 |
Relevant recent comments in issue #1408 - Until this issue is resolved, a workaround is described below -- it's a copy and paste of the original post in the balena forums. The following example regards the multiarch telegraf image. [...] the workaround is to append a sha256 digest to the FROM line of your Dockerfile, thus "manually selecting" the base image architecture. To do so, check the different sha256 digest for each available architecture on the Dockerhub page:
Choose one of the Dockerfile FROM lines from the table above, depending on your device type. The sha256 digests above were extracted from the Dockerhub page linked above, by using the dropdown box to select the target architecture. |
[pdcastro] This issue has attached support thread https://jel.ly.fish/0ccf5bab-fbf3-4f09-a3c5-f844a6a046d7 |
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
Bump version of balena-multibuild to the one that supports multiarch Remove previous hack to avoid sending platform information to multibuild Change-type: minor Signed-off-by: Paul Jonathan <[email protected]> See: #1508
At long last, this issue was resolved in CLI v12.49.0. 🎉 |
What exactly has been implemented, and how far does it go? It now has full multi arch image support so we no longer need to specify the sha? Does this apply for cloud builds or just local pushes? Does this mean there will be a gradual transition away from using the %%BALENA_ARCH%% string and we can just specify the image name? |
@Maggie0002 See answers below:
These changes allow support for manifest lists when doing a CLI build where there is more than one architecture. What does this mean?
That's the idea.
NOTE: These changes affect the CLI, they are not yet implemented in the cloud builder. But that should follow within the next few weeks since the bulk of the important changes are in code that is shared between them. |
To clarify, this is the case of a multi-stage Dockerfile with multiple There is no problem with the case of multiple services (in a
From balena CLI users' point of view, I understand that |
Thanks for the clarifications. To avoid leaving a question without an explanation, I am sure there are plenty of reasons for why someone would want the balenalib images to be multi arch, but mine include:
Best case scenario, would be the shift towards using multi-arch images instead of having to specify the variables like %%BALENA_ARCH%%, which it seems is now doable, but obviously a big shift in workflow for many people so understandably a more gradual process. Short term, it would be nice if the balenalib could start including a multi-arch image, alongside all the current ones, While not resolving some of the above issues, it seems like it would be an additional build process that could be added in without becoming a breaking change. It could allow those willing to gradually start moving over to that system, and would resolve my missing images issue I keep coming across, and dev env issue. Some food for thought to throw into your product discussion hat. Thanks again. |
Thanks for the feedback @Maggie0002 👍 There is something I would like to understand better. Balenalib images are available for not only multiple CPU architectures, but also multiple device types including development boards, for example:
Where the images are not only specific to a CPU architecture like ARM v7, but also specific to the on-board peripherals of the device type or development board, including possibly additional device drivers, libraries, co-processor support, etc. So when you say you would like balenalib images to be multi arch, two alternative meanings come to my mind:
I suspect option 1 would be opposed by balena's team because image sizes would grow significantly (e.g. Jetson devices require gigabytes of JetPack libraries) and might require extra logic to choose which device driver to load. As for option 2, it sounds interesting, even though it would multiply the already sheer number of "actual images" (counting each architecture the image is available for) by, hmm, maybe 3 (device's own architecture plus amd64 plus Apple Silicon), which I guess is doable. Or maybe you had something else in mind altogether? |
I didn’t give very good descriptions there, apologies. I choose not to use the name of the board for an image, such as raspberrypi3-Debian as it includes a bunch of device specific drivers that aren’t of use to me. I prefer smaller image sizes so opt for the arch specific images. So an example from my Dockerfile is: balenalib/%%BALENA_ARCH%%-alpine-python:3.8.10-3.13-20210603 Which would resolve on a raspberry pi 4 to something like: balenalib/aarch64-alpine-python:3.8.10-3.13-20210603 I then use that same image for all devices that are aarch64, whether they be raspberry pi or orange pi etc etc all attached to the same fleet. With support for multi arch images in the cloud and now CLI, an image with a name like balenalib/alpine-python:3.8.10-3.13-20210603 could now resolve to aarch64 by itself. Or on my developers computers, to amd64, or whatever is needed. All in one tidy package. Indeed it was thought it could be in parallel to the current images to avoid it being a breaking change, which would initially ballon the amount of images but I imagine many people using the BALENA_ARCH like me would gradually switch and an option in the future may present itself to reduce the number of images. Assuming my understanding of the images is correct, it’s a little surprising that images specified by name of board rather than by arch is the default considering the cost to image size and Balena’s goals of being as lean as possible. |
@toochevere FYI, I've added this to our tracking system: (restricted access) |
balena build
andbalena deploy --build
may fail with "exec format error" or related mismatched architecture errors when the base image in a Dockerfile FROM line is a multiarch base image, where a singlename:tag
reference includes multiple images of different architectures. Example:FROM ubuntu
where ubuntu is an image name that refers to multiple images of different architectures (ARM, ARM 64, 386, x86-64, PowerPC 64 LE, IBM Z, etc).balena build
andbalena deploy --build
have never had support for multiarch base images. Balena's original solution (that predates Docker's multiarch solution) is Dockerfile templates which work well with balenalib base images. While balenalib has alternatives toFROM ubuntu
, e.g.FROM balenalib/raspberrypi3-ubuntu
, there are no alternatives to other base images likeFROM nginx
orFROM telegraph
, so the CLI needs to implement support for such multiarch base images.Workaround
A workaround is to append the sha256 hash to image name on the FROM line, as detailed in #1508 (comment).
Edited from Matthew's original report:
The text was updated successfully, but these errors were encountered: