Docker multi-architecture - weird 'linux/arm/v7 not supported error'

While building a dedicated Docker image for ARM v7 I bumped into this weird error:

failed to solve: rpc error: code = Unknown desc = failed to load LLB: runtime execution on platform linux/arm/v7 not supported

Usually, I’d assume that the Docker image I’m referencing to is not built for ARM v7 or that I don’t have QEMU for building multi-arch images configured. However, this was not the case. All prerequisites were met and image was supporting 32 bit ARM architecture.

This was the exact command executed:

$ docker buildx build  --platform linux/arm/v7 -t my-image .
WARN[0000] invalid non-bool value for BUILDX_NO_DEFAULT_LOAD:  
[+] Building 1.6s (3/3) FINISHED                                                                     
=> [internal] load build definition from Dockerfile                        0.1s
=> => transferring dockerfile: 32B                                         0.0s
=> [internal] load .dockerignore                                           0.0s
=> => transferring context: 2B                                             0.0s
=> [internal] load metadata for docker.io/library/nginx:1.19.5-alpine      1.5s
failed to solve: rpc error: code = Unknown desc = failed to load LLB: runtime execution on platform linux/arm/v7 not supported

And this was the Dockerfile:

FROM nginx:1.19.5-alpine

ADD start.sh /

COPY ./target/web/. /usr/share/nginx/html/
COPY ./target/utils/. /usr/share/nginx/utils/

RUN chmod +x /usr/share/nginx/utils/env-config.sh
RUN chmod +x /start.sh

CMD ["/start.sh"]

Root cause

the issue was with the start.sh file that was using BASH:

#!/bin/bash

which was not installed. Changing to more basic sh solved the issue

#!/bin/sh

The most frustrating thing though was the lack of any kind of debug / verbose / logs that might trace you to the issue.

So, hopefully this will save someone time for the investigation.