In this tutorial it shows the following Docker file.
FROM --platform=linux/arm64/v8 torizon/debian:2-bullseye
RUN apt update && apt install nano -y
And sure enough, it succeeds.
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM --platform=linux/arm64/v8 torizon/debian:2-bullseye
2-bullseye: Pulling from torizon/debian
Digest: sha256:bde8dad15360c86832ebcd90ed0f769996cd77abc7f2cb45b289fd81203a30db
Status: Image is up to date for torizon/debian:2-bullseye
---> 84f558ea2bbe
Step 2/2 : RUN apt update && apt install nano -y
---> Using cache
---> 34e11105ce49
Successfully built 34e11105ce49
Successfully tagged username/gs-torizon:latest
If you add even one file that is not already in the container
FROM --platform=linux/arm64/v8 torizon/debian:2-bullseye
RUN apt update && apt install nano cmake make -y
This most definitely does not succeed.
Step 2/2 : RUN apt update && apt install nano cmake make -y
---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
---> Running in fadd624fa6b3
standard_init_linux.go:228: exec user process caused: exec format error
The command '/bin/sh -c apt update && apt install nano cmake make -y' returned a non-zero code: 1
After wasting an afternoon believing this should work I have come to the conclusion that the only reason the “getting started” tutorial worked was nano already existed in the container. Since apt didn’t actually have to install anything the error never surfaced.
It would be really nice if the “getting started” example showed an actual install of something that didn’t exist in the container and how to get around the above error. In fact, they could keep with the editor theme of the example and just install “jed.” It’s a terminal editor that is not normally installed in most Debian distros.
As of right now I have looked at everything on the docker sites, Stack Overflow (I know!), Quora, and a whole bunch of github projects that seem to have the exact same problem.
There is no joy in Mudville.