How do I build a Docker image for an ARM device?

I’m noticing exec user process caused "exec format error" when trying to run a Docker image on a Raspberry Pi 4.

First I’m bewildered that a Docker image is pulled that won’t run on the platform to begin with. Nonetheless I am keen to make it work, but I don’t know how.

Here’s the project: How can I build ARM compatible images?

Source: StackOverflow