balenaOS in a docker container won´t connect to balenacloud

Hi there,

I´m trying to run a BalenaOs App, originally made for the RPi 4 (and actually running on about 100 devices), on a RPi 3 in a docker Container (only for testing later it´l be a non supported Hardware that´s why I´m running it in a Docker on a native OS).
Problem: Docker is running but not connecting with the balenacloud. I tested it with another Balena project (Pihole for RPi 3) and it worked.

Has someone experience with running a BalenaOS which wasn´t designed for the Hardware it´s running on in a Docker Container?

Thanks for helping

Simon

Hello, this issue most likely stems from RPi4 BalenaOS images being aarch64, and the RPi3 being arm7, meaning they’re incompatible. What RPi3 version are you using? It may be possible to get the OS on the RPi3 running an armv8/64 kernel, which may (or may not!) make the balenaOS image compatible.

@rcooke-warwick thanks for the answer it´s only for tests on a RPi3 in the long run it should run on a conga-QA3 with Intel Atom 3rd Gen. so I think the only solution is to make a custom BalenaOS Image for that platform.

Hi, I’m not familiar with this board, but assuming it is this one https://www.congatec.com/en/products/qseven/conga-qa3.html, you could try our generic x86 image, which is available here under Intel Nuc https://www.balena.io/os/.

If that fails, I’d like to point you to our supporting custom board docs https://www.balena.io/os/docs/custom-build/#Supporting-your-Own-Board. If you do go that route, please do let us know if you hit any issues that we could assist with.

Thanks I´ll try that out

As another test I installed everything exactly like on the RPI3 on a RPI4 but I can´t find the balenaos-in-container.sh after docker pull resin/resinos:2.47.1_rev1.dev-raspberrypi4-64 do you know where this is located?

Hey, that script is available here: https://github.com/balena-os/balenaos-in-container and in fact that repository is the supported method of getting balenaOS running in a container.

The Problem is after i pulled the docker container i cannot install my Balena App with the command ./balenaos-in-container.sh --image resin/resinos:2.47.1_rev1-raspberrypi4-64 --id test -c "/tmp/config.json" --detach because it can not find the balenaos-in-container.sh

pi@raspberrypi:/ $ sudo ./balenaos-in-container.sh --image resin/resinos:2.47.1_rev1-raspberrypi4-64 --id test -c “/tmp/config.json” --detach
sudo: ./balenaos-in-container.sh: command not found

Please ensure that the script is in the same directory that you are executing the command from, and that it has been marked as executable (you can check this with ls -lh and mark it as executable with chmod +x)

Ok, found my mistake in not installing the script right.
For everyone else this is what i´ve done:

sudo apt-get update && sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo apt-get install git
git clone https://github.com/balena-os/balenaos-in-container.git
sudo docker pull resin/resinos:2.47.1_rev1.dev-raspberrypi4-64
cd balenaos-in-container
sudo ./balenaos-in-container.sh --image resin/resinos:2.47.1_rev1.dev-raspberrypi4-64 --id test -c “/tmp/config.json” --detach

At the moment the container isn´t starting after this but I´m not sure if that hasn´t another problem

Glad it worked! If the container is not starting, perhaps you can remove the --detach flag and examine logs carefully to see if you spot the error.

@tmigone these are the whole logs

pi@raspberrypi:~/balenaos-in-container $ sudo ./balenaos-in-container.sh --image resin/resinos:2.47.1_rev1.dev-raspberrypi4-64 --id test -c “/tmp/digital-signage-rpi.config.json”
INFO: Reusing balena-boot-test docker volume…
INFO: Reusing balena-state-test docker volume…
INFO: Reusing balena-data-test docker volume…
INFO: Running balenaOS as container balena-container-test …
WARNING: Localhost DNS setting (–dns=127.0.0.2) may fail in containers.
standard_init_linux.go:211: exec user process caused “exec format error”
failed to resize tty, using default size
INFO: balenaOS container stopped.

Generally exec format error means you’re running some code that’s intended for a different architecture. As comment made above:

Hello, this issue most likely stems from RPi4 BalenaOS images being aarch64, and the RPi3 being arm7, meaning they’re incompatible.

Hmm, that´s weird because it´s a config from a balena project that´s already running on RPI4

It runs on rpi4, but now you are trying to run same rpi4 image on rpi3, is that correct?

no, that´s what i´ve tried before now it´s RPI4 with Docker running Balenaos in a Docker

Which OS is installed currently on your rpi4?

Raspbian Buster Lite

Raspbian is 32 bit, can you confirm? That must be the reason for incompatibility.