BalenaOS as docker on RPI4 error

I’m trying to run balenaOS in a docker container on a RPI4 (Raspbian latest) and then run a python application service. I’m able to run balenaOS in a container but when a service is added I get the same error across several balena example projects
standard_init_linux.go:207: exec user process caused “exec format error”

the balenaOS images specify OS/ARCH linux/amd64 where my docker install is linux/arm.

any help debugging the issue?


docker (on raspbian)
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:35:24 2020
OS/Arch: linux/arm
Experimental: false

balena-engine version (balenaOS host)
version: 18.09.10-dev
api version: 1.39
Go version: go1.10.8
OS/ARCH: linux/arm


The issue that you are seeing is typically seen when the architecture that you are trying to run an application on, isn’t the one that the application was compiled for. So for example if you tried running an aarch64 application on x86 or something similar. You should pick the right os image for your architecture.

thanks @anujdeshpande,
Although I’m still not sure where the incompatibility is. I am able to run (launch from Docker on Raspbian OS) BalenaOS image even though my OS/ARCH is linux/armv71 while the image is specified as linux/amd64. The container is communicating with BalenaCloud and I can push application builds from BalenaCLI.
BalenaOS image tag: resin/

From there, I’ve tried building an application image (in BalenaCloud) and pushing to my devices using balenaLib base image and python base image from docker hub. In both cases, the image is successfully built but continually restarts with the above error.

the balenaOS in a docker container respiratory looks to only offer builds of OS/ARCH linux/amd64

is there a balenaOS image (for docker) that runs on armv71 out there?


Is there a reason you want to run balenaOS in a container and then run a container inside that? You could just use one of the balenalib python images and build your service natively. BalenaOS essentially runs Docker on the HostOS, and you can deploy containers on it.


running balenaOS in a container is a work around. I have several pieces of external hardware for wireless communication that needs to configured using systemd and kernel. I originally was able to configure in Raspbian but balenaOS makes it a little hard to do, thus running balenaOS in a container allows configuration of the host while still having the benefit of balena supervisor and remote deployment.
BalenaOS does offer wifi hotspot and GSM configuration (
For the hotspot, I still need to figure out how to configure static IP address for my known clients (I know the mac address a priori). For the GSM, I still need to test my hardware compatibility with ModemManager and balenaOS.

So again, running balenaOS in a container was a faster known path to configure the host wifi hotspot and GSM.

Hello there, have you seen this repository: There are a few scripts in there that might be of interest to you.
That said, we do not recommend using balenaOS in container for production environments as it’ss mostly uncharted territory at this point.

thanks @tmigone
I used that repository to build a balenaOS image running on my RPI4 docker daemon. Prerequisite #4 states the balenaOS image needs to be compatible with host architecture. My confusion above is about where the incompatibility resides. The repository links to resin/resinos docker repository where I found the raspberry-pi tag to use in the docker build script
docker pull resin/
I assumed this image is compatible with raspberry-pi but the image OS/ARCH lists linux/amd64, which the PI is not.

I assumed this image is compatible with raspberry-pi but the image OS/ARCH lists linux/amd64, which the PI is not.

@rcalderon, perhaps the CPU architecture mismatch is not between arm and amd64, but rather between the different RPi architectures:

Or not. But I think I have got evidence that the images linked above are not amd64 images, because I actually got a couple of them running on a Raspberry Pi 4:

root@dcbff32:~# balena-engine run -it resin/ /bin/bash
bash-4.4# cat /etc/issue
balenaOS 2.48.0 \n \l

bash-4.4# uname -a
Linux b77aeae18f84 4.19.75 #1 SMP PREEMPT Mon Mar 23 11:50:49 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
root@dcbff32:~# balena-engine run -it resin/ /bin/bash
bash-4.4# cat /etc/issue
balenaOS 2.48.0 \n \l

bash-4.4# uname -a
Linux 8b0cf317a9c5 4.19.75 #1 SMP PREEMPT Mon Mar 23 11:50:49 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

My Pi 4 was running a “standard” balenaOS installation (v2.48.0 development image), rather than Raspbian, and running balenaEngine rather than Docker. Therefore I was running balenaOS on balenaOS.

Furthermore I was able to successfully run the script (balenaos-in-container project) on a RPi 4 with balenaOS (balenaOS on balenaOS):

On the balenaOS host OS:

$ cd /mnt/data
$ curl -LO
$ unzip
$ cd balenaos-in-container-master
# Copied-and-pasted a config.json file downloaded from balenaCloud
$ vi config.json
# Edited "" to replace "docker" with "balena-engine"
$ vi
$ ./
./ --image resin/ --id test -c "$PWD/config.json" --detach
INFO: Creating balena-boot-test docker volume...
INFO: Creating balena-state-test docker volume...
INFO: Creating balena-data-test docker volume...
INFO: Running balenaOS as container balena-container-test ...
WARNING: Localhost DNS setting (--dns= may fail in containers.
INFO: balenaOS container running as balena-container-test

$ balena-engine ps -a
CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS                      PORTS               NAMES
40ad03481283        resin/   "sh -c '/aufs2overla…"   18 seconds ago      Up 16 seconds                                   balena-container-test

$ balena-engine exec -it balena-container-test /bin/bash
bash-4.4# cat /etc/issue
balenaOS 2.48.0 \n \l

Anyway, try the Pi 4 image instead of the Pi 1 / Zero image. It is not clear that this was the problem you were having and it may still not work, but at least it would be a better match for the RPi 4.

Another note: Raspbian is a 32-bit OS, right? In which case, maybe, the RPi 3 (32 bits) image might be more suitable. Try the RPi 3 (32 bits) and the RPi 4 (64 bits) images – either sounds more promising than the RPi 1 / Zero image.