How to Build AMD64 Docker Images from a Mac M3 (Apple Silicon)
When Apple introduced the M1, M2, and now the M3 chips, we all got excited about the performance and battery life. But as a backend…
How to Build AMD64 Docker Images from a Mac M3 (Apple Silicon)
When Apple introduced the M1, M2, and now the M3 chips, we all got excited about the performance and battery life. But as a backend developer and DevOps engineer, I quickly ran into a silent problem: the difference between my machine’s architecture and that of most production servers.
After building Docker images on my Mac M3 and deploying them to services like Google Cloud Run, AWS ECS, or even traditional Linux servers, I was met with this lovely error:
exec format error
What’s happening here? Well, Macs with M-series chips use ARM64 (arm64), while most cloud servers still run on x86_64 (amd64). By default, Docker builds on Apple Silicon will create images for arm64, which simply won't run on amd64 systems unless you tell Docker otherwise.
So, let’s fix this. I’ll walk you through how to properly build amd64 images from a Mac M3, and optionally make them multi-platform for broader compatibility.
🧠 What Are arm64 and amd64, Anyway?
Let’s break it down:
amd64(also known asx86_64) is the architecture used by most cloud VMs, servers, and traditional Intel/AMD machines.arm64is the architecture used by Apple Silicon (M1/M2/M3), Raspberry Pi, and most mobile devices.
When you build a Docker image on an Apple Silicon machine, it defaults to arm64. If you try to run that on an amd64 system, it’ll fail.
🐳 Why Doesn’t Docker Just Handle This?
Good question.
Docker on Apple Silicon is already using emulation under the hood for many things. But when you build an image, it reflects your native architecture — unless you explicitly ask it to build for another one.
To do that, we use docker buildx, a more advanced tool for cross-platform builds.
⚙️ What Is docker buildx?
buildx is an extension to the traditional docker build command. It enables:
- Multi-platform builds (
--platform) - Architecture emulation (via QEMU)
- Better caching and performance
- More advanced build workflows
Most recent Docker Desktop versions include it out of the box.
🛠️ Step-by-Step: Building amd64 Images from an M3 Mac
✅ 1. Check if buildx is installed
docker buildx version
If it’s installed, you should see something like:
github.com/docker/buildx v0.x.x-docker ...
If not, just update Docker Desktop or install the CLI plugin.
🧱 2. Create a buildx builder with emulation support
Let’s create a named builder that supports emulated platforms:
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
This initializes the builder and ensures QEMU is ready to emulate non-native architectures like amd64.
🧪 3. Prepare your Dockerfile
Here’s a simple example in Go:
# Dockerfile
FROM golang:1.21 as builder
WORKDIR /app
COPY . .
RUN go build -o main
FROM debian:bullseye-slim
COPY --from=builder /app/main /main
ENTRYPOINT ["/main"]
🏗️ 4. Build your image for amd64
Here’s the critical part:
docker buildx build --platform linux/amd64 -t myapp:latest --load .
--platform linux/amd64: tells Docker to build for x86--load: loads the image locally (slower but useful for local testing)
☁️ 5. (Recommended) Push directly to your registry
For production workflows, pushing to a container registry (Docker Hub, GCR, ECR, etc.) is often better than loading locally:
docker buildx build --platform linux/amd64 -t myrepo/myapp:latest --push .
This skips local emulation entirely and pushes a clean amd64 image ready to use on any server.
🌍 Bonus: Building Multi-Platform Images (amd64 + arm64)
Want one image that runs both on x86 and Apple Silicon? Easy:
docker buildx build --platform linux/amd64,linux/arm64 -t myrepo/myapp:latest --push .
This creates a manifest list that allows each platform to pull the correct architecture-specific image.
🔍 How to Inspect Your Image’s Architecture
If you want to check what architecture your image uses:
docker image inspect myapp:latest | grep Architecture
Or, if it’s already pushed to a registry:
docker buildx imagetools inspect myrepo/myapp:latest
🧠 What About CI/CD?
You can use buildx easily in CI environments like GitHub Actions or GitLab. Just make sure to set up buildx and qemu.
Example: GitHub Actions workflow
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and Push Image
run: |
docker buildx build \
--platform linux/amd64 \
-t myrepo/myapp:latest \
--push .
🚀 Real-World Impact
After switching to this method:
- No more
exec formaterrors in ECS or Cloud Run. - One build pipeline that works for any target environment.
- Fully automatable, compatible with CD tools.
Whether you’re building microservices, AI backends, or static servers, building the right architecture matters — especially as more developers move to Apple Silicon.
🧩 Final Thoughts
Apple Silicon is a fantastic platform, but it introduces some nuances in the DevOps world — especially with Docker. Fortunately, tools like buildx make cross-architecture builds seamless.
If you’re working from an M1, M2 or M3 Mac and deploying to x86 infrastructure, get comfortable with buildx. It’s the key to building production-ready images that just work, no matter where you deploy.
메타데이터
- post_id
- ce84fda0bcfc
- slug
- how-to-build-amd64-docker-images-from-a-mac-m3-apple-silicon-ce84fda0bcfc
- url
- https://medium.com/@msalinas92/how-to-build-amd64-docker-images-from-a-mac-m3-apple-silicon-ce84fda0bcfc
- canonical_url
- https://medium.com/@msalinas92/how-to-build-amd64-docker-images-from-a-mac-m3-apple-silicon-ce84fda0bcfc
- author_url
- https://medium.com/@msalinas92
- status
- ok
- fetched_at
- 2026-07-20 03:01:46