Trouble running containers with normal deploy instead of local push

@gerb0n, I think what is happening is that the base image (nginx:1.17.1-alpine) uses Docker Hub “manifests” to differentiate between architectures (like amd64 vs. arm64v8), but the balena CLI still does not understand those manifests and requires different image tags, or the full sha256 hash to be specified (issue 1508).

Emulation does not help / apply because emulation is used while building the image, in order to execute RUN instructions in a Dockerfile. The Dockerfile you’ve shared (thanks!) does not even contain RUN instructions, and in any case the balena CLI --emulated flag is ignored when Docker Desktop is used (because Docker Desktop uses binfmt_misc in order to run the RUN instructions in the Dockerfile).

The workaround I suggest is to add the sha256 hash of the intended architecture (arm64v8 for the RPi 4) to the FROM line. The sha256 hash can be found in Docker Hub, browsing the tags for the nginx image and filtering for 1.17.1-alpine:

So a “good” Dockerfile for the RPi4 would probably be:

FROM nginx:1.17.1-alpine@sha256:ba0713e56ea1d0ce7aad766529dda12c2e47e1fcb2b6ee0079ada8c575873c3a
COPY /html /usr/share/nginx/html

I tested the Dockerfile above with balena deploy and an RPi4, and it avoids the exec format error message (which happens if I use the amd64 hash, or no hash).

Let us know if this workaround works for you. You can also subscribe to GitHub notifications for issue 1508.