Fix M1 Docker Images Build Issue

Santiago Álvarez
1 min readJan 18, 2023

Apple´s new MacBooks based on a M1 chip have a different architecture arm64 instead Intel's amd64 like the old ones.

This could give you many issues trying to build your docker images in your local environment for testing or making docker images compatible with other environments like EC2 instances or lambda functions with amd64 architecture.

The solution is called buildx that is a Docker CLI plugin for extended build capabilities with Buildkit.

You must execute the following command to build a docker image in your M1 laptop to make it work properly:

docker buildx build --platform linux/amd64 -t <image_name>:<version>

# For example
docker buildx build --platform linux/amd64 -t test_image:latest

This would build a docker image that could work in your M1 chip laptop and you are not going to face any problem to deploy your image as a container in your amd64 linux server.

I hope this article could be helpful for you! Any suggestions or comments are welcome.

--

--