brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: platform: linux/amd64 runs an x86 only Docker image on an ARM machine

Docker
~/tips/tip-docker-compose-platform-amd64

platform: linux/amd64

Ask for a specific image architecture when the default one does not exist.

On an Apple Silicon Mac or a Raspberry Pi, an image that was only built for x86 fails with a message that no matching manifest was found for your platform. The platform attribute asks for the other architecture explicitly.

services:
  legacy:
    image: example/legacy-tool:2.1
    platform: linux/amd64

On the command line it is docker run --platform linux/amd64. Docker pulls the amd64 variant and runs it through emulation. Docker Desktop has that emulation built in; on a Linux host it needs QEMU binfmt handlers installed first.

To find out which architectures an image offers before you try, ask the registry:

docker buildx imagetools inspect example/legacy-tool:2.1

I see this as a stopgap. Emulated containers run noticeably slower, use more CPU, and the odd program crashes under emulation in ways it never would on real hardware. If an arm64 build exists, even under a different tag, I would pick that one. It also works the other way round: pinning linux/amd64 in a shared file makes every ARM user run emulated, so keep the line in a local override instead of the main file.

Further reading: Compose file reference: platform, Multi-platform builds

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link