Open odyslam opened 5 years ago
@OdysLam It looks like you are trying to run docker build .
on your x86 machine whereas the binaries in the container are a different architecture. You probably need to install qemu and binfmt in your host OS.
Here is a blog post with the info
https://www.balena.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/
The balenalib repos already have qemu-aarch64-static so it is easy to just run them under qemu via binfmt.
zubairlk@zubair-xps-resin:~$ docker run --rm -i -t balenalib/raspberrypi3-64-ubuntu /bin/bash
root@bbf45cc90e50:/# find /usr/ | grep qemu
/usr/bin/qemu-aarch64-static
root@bbf45cc90e50:/# exit
exit
zubairlk@zubair-xps-resin:~$ dpkg -l | grep binfmt
ii binfmt-support 2.1.6-1 amd64 Support for extra binary formats
zubairlk@zubair-xps-resin:~$ dpkg -l | grep qemu
ii ipxe-qemu 1.0.0+git-20150424.a25a16d-1ubuntu1.2 all PXE boot firmware - ROM images for qemu
ii qemu 1:2.5+dfsg-5ubuntu10.34 amd64 fast processor emulator
ii qemu-block-extra:amd64 1:2.5+dfsg-5ubuntu10.34 amd64 extra block backend modules for qemu-system and qemu-utils
ii qemu-efi 0~20160408.ffea0a2c-2 all UEFI firmware for virtual machines
ii qemu-slof 20151103+dfsg-1ubuntu1.1 all Slimline Open Firmware -- QEMU PowerPC version
ii qemu-system 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries
ii qemu-system-arm 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (arm)
ii qemu-system-common 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (common files)
ii qemu-system-mips 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (mips)
ii qemu-system-misc 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (miscelaneous)
ii qemu-system-ppc 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (ppc)
ii qemu-system-sparc 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (sparc)
ii qemu-system-x86 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU full system emulation binaries (x86)
ii qemu-user 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU user mode emulation binaries
ii qemu-user-static 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU user mode emulation binaries (static version)
ii qemu-utils 1:2.5+dfsg-5ubuntu10.34 amd64 QEMU utilities
zubairlk@zubair-xps-resin:~$
@ZubairLK
Hey, thanks for the extensive reply, it makes sense. I thought that Balena automatically built the containers for the needed architecture, I guess that's when using the online process and not the local dev mode.
Also, what about the build functionality of balena cli? Is it possible to build them on the rpi itself (although it's highly non optimal). Will definately check it out.
One last question, since I will be using already built containers (Edgex), how can I know whether they will run on the Raspberry pi ? (I know that it's not balena relevant).
Anyhow, thanks!
@OdysLam it is possible to build the functionality on the device. Quite slow though.
From https://www.balena.io/docs/learn/develop/local-mode/
It uses the Docker daemon on the device to build container images
If edgex provide containers for the armv6/7 architecture, they should run on the rpi.
I guess you can check by running balenaOS, ssh into the hostOS, then run
balena run -i -t urlforedgexdocker /bin/sh
If it gives an exec format error, the architecture is wrong.
@ZubairLK Actually I discovered that using the balena CLI it is possible to build locally on the machine and emulate it automatically (--emulate) and then forward it on the machine. https://github.com/balena-io/balena-cli/blob/master/doc/cli.markdown#local-ssh-deviceip
Regarding the test you propose, what do you mean by "urlforedgexdocker"
I see that containers are working normally from the balena point of view. I now want to determine whether they actually work as intended. Will try to post a relevant guide or something in the future. Thank you so much
@OdysLam okay, I think I understand - the containers built and ran, but the service inside your container didn't start up? perhaps my issues have something to do with alpine
then, which I am using in place of ubuntu
.
I'll give your technique a try and see if switching to the same image helps. Thank you again
Greetings,
I have been trying to configure Balena with EdgeX foundry services but with no luck so far.
Image: balenalib/raspberrypi3-64-ubuntu
every command will produce "standard_init_linux.go:195: exec user process caused "exec format error""
Example:
Dockerfile
Compose: