Deploy locally built image

Hi,

I successfully cross-built a container image for a Jetson Nano using

docker buildx build . --platform linux/arm/v7 --load

Now I’d like to push it to my device, which is set to local mode, executing:

./balena deploy $APPNAME $CONTAINER-ID

where $APPNAME is obtained by ./balena apps.

So far, so good. The deploy succeeds, printing the success-unicorn in the log.
But when ssh-ing into the device, the image is not listed! (Also, on my local computer used for building the image, the image disappeared.)

Does anyone have a clue as to what’s going on?

Cheers,
Felix

Edit: Corrections, see post below

Hi Felix

Can you share a bit more information about your setup please? Are you using openBalena or balenaCloud? Have you tried using balena build (or balena deploy --build) instead, and if so, does it succeed then? Also, I assume by $DEVICENAME you mean $APPNAME?

On your local computer, unless you run the image, there shouldn’t be a container as far as I am aware. Which command did you run on the device to see if the image is there?

If using balenaCloud, you can maybe enable support access to the device and share the UUID with us so we can have a look at it?

Thanks,
Steve

Hi Steve,

thanks for your quick reply - I edited/fixed the post above. You were right with your assumptions.

Quick answers:

  • I’m using balenaCloud
  • I have not tried using balena build yet. Am I supposed to include
    RUN [ "cross-build-start" ] and RUN [ "cross-build-end" ]
    to the Docker file, then? I suppose it’s adding QEMU to the base image to make the ARM image locally executable?
  • You’re right, there shouldn’t be a container. I meant to say image.
    $ docker image ls
    I was using before and after executing deploy; after execution, the container vanished.

I’d greatly appreciate if you took a look - I’d probably contact you later in the day or tomorrow via PM.

Thanks a lot
Felix

Hi Felix

Here are the docs for the balena build command: https://www.balena.io/docs/reference/cli/#build-source. You don’t need to add anything special to the Dockerfile, the CLI does a couple of things under the hood to make sure a Dockerfile can be built for different architectures. You can just try it first, and let me know how it goes.

Hi,

unfortunately this did not make a difference. The image was built and deployed successfully, but does not appear on the device when executing: $ balena-engine image ls.

I’ll PM you the device UUID.

Cheers,
Felix

Hey,

So that device is in local-mode which means you can only balena push {ip address} to put your code on it. Your deploy is pushing the image to the cloud registry, and I see 4 releases there, but the device won’t pull them down until it’s taken out of local-mode.

Hi Rich,

I see! That’s the solution, then.

Thanks a lot!

Hello @fplum

Unfortunately, balena push flow for local mode devices does is not fully ready for using pre-built images. Hence, there are several points to keep in mind.

  1. When you refer to a pre-built image in docker-compose file, you need to have it published in some registry. balena push currently does not have a mechanism to transfer a prebuilt image from your local machine to the device. And the engine on the device will need to download this image from a registry. Technically, such transfer is possible and we have plans to implement it in the future.
  2. Also, due to some issues on our cloud builders’ side, using multi-arch images built with buildx is not fully supported when you use a production deployment flow (with balena deploy or balena push or git push). Depending on your device type, a wrong image variant can be pulled and service will fail to start. We should resolve this problem in the near future though. The current workaround is to refer to a specific architecture variant tag from your docker-compose file.

Hope this helps to avoid the problems. We’ll also update this threads when the corresponding isssues are resolved.

1 Like