Docker build on Mac M1 M2 not working on linux server machine

When we build docker image on Apple silicon Mac M1 and M2, the containers build by default are built on top of linux/arm.

If your server’s processor’s architecture is linux/amd, you might want to build images for the linux/amd architecture.

You can choose to build for multiple architecture using --platform option on docker buildx build

Here is the full syntax i used to build realanmup/laradocker docker image on my macbook air m2.

docker buildx build --platform=linux/amd64 . -t realanmup/laradocker

You might want to learn more about building docker images for multiple architecture on the docker’s docs.