In the course of development I’ve taken to using the balenalib Docker images with Docker before deploying to a device running BalenaOS. I noticed recently that I’ve been getting a warning when doing docker builds about the platforms not matching the host. These are being built on an 8 GB RPi4 running 64 bit Ubuntu 20.04
ubuntu@ubuntu:~/test$ uname -a
Linux ubuntu 5.4.0-1032-raspi #35-Ubuntu SMP PREEMPT Fri Mar 19 20:52:40 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@ubuntu:~/test$ docker --version
Docker version 20.10.5, build 55c4c88
Output from a Docker build of the base image I’m using followed by “balena-idle” for the image command, I added the --platform flag there to try and ensure I was getting the right image
ubuntu@ubuntu:~/test$ docker build .
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM --platform=linux/arm64/v8 balenalib/raspberrypi4-64-debian-python:3.6-buster-build
3.6-buster-build: Pulling from balenalib/raspberrypi4-64-debian-python
f8be76fcf206: Pull complete
8d908058a169: Pull complete
e656b43c6ba1: Pull complete
518bc7ceb288: Pull complete
3ba627db1522: Pull complete
2ba9f9edbf93: Pull complete
333687e8653e: Pull complete
3d913a5e6f2e: Pull complete
3769f7c83033: Pull complete
5a01cc6bf2f9: Pull complete
41292e13e818: Pull complete
d47268aa255f: Pull complete
d847bbf19156: Pull complete
b72cefa65302: Pull complete
37576db03f26: Pull complete
f4104ae6c790: Pull complete
2d3779c5d8d5: Pull complete
be68628fd58a: Pull complete
23e6f7b9dc1b: Pull complete
21da907fc495: Pull complete
b654f64a8edc: Pull complete
3d54411f6478: Pull complete
0a556c9eee24: Pull complete
29e0564bef9b: Pull complete
bf3846a54f41: Pull complete
ec2f1e3a210c: Pull complete
09668e474e02: Pull complete
Digest: sha256:b16169d0f50f872d4578ffa3edcbcc79d79e1bc8e415fddccfa84546082ee6fe
Status: Downloaded newer image for balenalib/raspberrypi4-64-debian-python:3.6-buster-build
WARNING: Pulled image with specified platform (linux/arm64/v8), but the resulting image's configured platform (linux/amd64) does not match.
This is most likely caused by a bug in the build system that created the fetched image (balenalib/raspberrypi4-64-debian-python:3.6-buster-build).
Please notify the image author to correct the configuration.
---> 73d741710096
Step 2/2 : CMD [ "balena-idle" ]
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
---> Running in 7108fc255d35
Removing intermediate container 7108fc255d35
---> e06c9f5e3940
Successfully built e06c9f5e3940
I’m assuming the platform inconsistencies are from the cross compilation magic, the images seem to work just fine but the warning confused me for a while.