Fewer errors and warnings about images not matching host platform (esp. for M1 Macs)

Docker emits an annoying warning complaining about amd64 (default) images when run on M1 Macs. Yet ARM support is still fairly immature, making this warning largely unactionable.

A better place to put such a warning would be an owner-only view of the registry homepage for that image. But even then, many projects have technical reasons for not being able to support natively arm64 etc etc images and must continue using amd64.

Perhaps up to 80% of project would benefit from supporting ARM buildx platforms. But many things continue to be broken in non-x86 family environments. I’d really encourage M1 Mac users to stick to amd64 images for the foreseeable future. At the very least, don’t bother griping about amd64 images on M1 mac hosts, where we enjoy compatibility with amd64.

As a workaround, I plan to configure the environment variable DOCKER_DEFAULT_PLATFORM as “linux/amd64” on the majority of my devices. That would have been a useful configuration for Docker Desktop to automatically assume on M1 Macs, until the arm64 Linux package maintainers fix their gcc and clang bugs. (Most things work okay in arm64, but cross-compilation from non-x86_64 build environments is an abject failure.)

Perhaps extending the fallback platform to an array of fallback platforms, would help to curtail spurious warnings. In addition, this would help to clarify the level of support for 32-bit images (e.g. “386”) on 64-bot hosts, some of which reject 32-bit processes.

Related to this kerfuffle is the awkward fact that M1 Macs are perfectly capable of docker buildx loading and docker running linux/amd64 images just fine. But the docker pull / run commands are ignorant of this capability. They blindly refuse to download linux/amd64 as a fallback option. When most Docker images are available in neat amd64 packaging. No, docker pull / run give up and vomit a low level error message.

We could easily improve the default behavior in those two spots, from erroring, to simply pulling and running classic linux/amd64 images automatically. That’s what a “fallback” means to me.