How to build amd64 docker images on Apple Silicon
If you’re on Apple Silicon, it’s likely that the infrastructure that you deploy your code onto is using amd64
instead of arm
. This means that docker images you build on your computer won’t be able to execute on your servers.
You might run into an error that looks like this:
exec user process caused: exec format error
To fix it, you’ll have to rebuild your docker image for amd64
.
Instead of:
docker build .
You’ll need to use:
docker buildx build --platform linux/amd64 .
You may also pass in multiple architectures at once by separating them with a comma like this:
docker buildx build --platform linux/amd64,linux/arm64 .
Resources
Join the 80/20 DevOps Newsletter
If you're an engineering leader or developer, you should subscribe to my 80/20 DevOps Newsletter. Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.
Not sure yet? Check out the archive.
Unsubscribe at any time.