Each container image has processor architecture. That architecture describes where you can run them on. It's the similar, like in OS executable binaries.
If you want to run your application on amd64, you should build your code on amd64 processor. Nowadays, toolkits and emulators allow you to build the code anywhere. This is buildx for docker. It's a plugin that you can install by following the link: GitHub. Buildx has extra capabilities than only multi-arch builds.

Container images can be built for different architectures. Then you can combine them into a single image tag. Actually, this is called image manifest file. That file has references for the regarding architectures.

Build Image from Dockerfile - buildx

Let's build a container image for linux/amd64 and linux/arm64 architectures. We can use buildx for that. First we need to install it

Buildx and buildkit is already enabled in Docker Desktop

Buildx has builder instances for the builds. Each build is executed inside them. The advantage of them, they provide isolated environments. You can even set up a build farm with a set of builders. You can switch between the builders.

For building multi-platform images; follow below

docker run --privileged --rm tonistiigi/binfmt --install all

docker buildx create --use --name multi-arch node-amd64
docker buildx create --amend --name multi-arch node-arm64

# List and switch contexts
docker buildx ls
docker buildx use --builder multi-arch

The builder instances are ready to use. We can build container images in two architectures on the same host.
--push parameter pushes the image to the repository. If you want to keep in local pass --load parameter.

Build Multi-Arch images

docker buildx build \
	--platform linux/arm64,linux/amd64 \
	--push \
	--tag [image_tag] \
	.