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
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.