Was the "Getting Started" Docker file a bit of a cheat

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.

Never mind.

I forgot I had rebooted the VM and needed to run my enable-arm script.

docker run --rm -it --privileged torizon/binfmt

docker run --rm -it arm32v7/debian arch

docker run --rm -it arm64v8/debian arch

Forget just one command and it can ruin your afternoon.

Sorry to bother.

Greetings @seasoned_geek,

Glad to see you were able to resolve your issue. For future reference, when building a container image if you see an error like standard_init_linux.go:228: exec user process caused: exec format error. This typically hints to a mismatch in compute architecture, and should be the first thing to check when debugging.

Best Regards,
Jeremias

Yeah,

Well, when one is heads down doing a dozen things the obvious gets overlooked… Just one of those days yesterday.

Btw, it was still a cheat. That example works even when you don’t have the environment set to allow arm. Nano is already installed in the container so the line did nothing. They should rewrite that example with Jed.