Running Docker on ARM servers: what breaks and how to fix it
- Image architecture
- Building multi-arch images
- Native dependencies
- Binaries downloaded in Dockerfiles
- Performance differences
- Mixed fleets
- A safe trial
ARM servers from Hetzner, AWS Graviton, Oracle and others often cost noticeably less than x86 machines with similar performance. Most Docker workloads run fine on them. The problems that do appear are predictable and fixable.
Image architecture
An image built on an x86 laptop is linux/amd64. On an ARM server it fails with exec format error or runs slowly under emulation if QEMU is installed. Check what an image supports:
docker manifest inspect node:22-alpine | grep architecture
Official images for Node, Python, Postgres, Redis and most popular tools are multi-architecture. Smaller third party images sometimes are not.
Building multi-arch images
Use Buildx to build for both platforms:
docker buildx build --platform linux/amd64,linux/arm64 -t registry/app:tag --push .
Building ARM on x86 through emulation is slow. Faster options are native ARM CI runners, which GitHub and others offer, or building directly on the ARM server.
Native dependencies
Packages with compiled code, such as sharp, bcrypt, psycopg2 or Ruby gems with C extensions, must be compiled or downloaded for ARM. Most now ship ARM binaries. If installation falls back to compiling from source, add build tools in the build stage.
Binaries downloaded in Dockerfiles
Lines like curl -L https://example.com/tool-linux-amd64 hardcode the architecture. Use the TARGETARCH build argument:
ARG TARGETARCH
RUN curl -L https://example.com/tool-linux-${TARGETARCH} -o /usr/local/bin/tool
Performance differences
ARM cores perform well for web servers and databases. Some workloads that rely on x86-specific instructions, such as certain media encoders, may be slower. Benchmark your own app rather than relying on general numbers.
Mixed fleets
You can run ARM and x86 servers side by side if every image is multi-arch. Label servers by architecture in your inventory so nobody deploys a single-arch image to the wrong machine.
A safe trial
- Rent the smallest ARM server
- Deploy staging there
- Compare response times and memory use for a week
- Move production if the numbers hold
Architecture is one of several levers for lowering hosting costs. For others, such as consolidation and right-sizing, see this guide on cutting your cloud bill with Docker.
Disclosure: I work on Peon.
Write a comment