With the propagation of Apple M1 chips, we've encountered a problem. We are using Docker to build images to deploy our software, but we discovered that some images which are built from Dockerfiles like this:
FROM ubuntu:20.04 as base
...
are no longer working in our infrastructure. Those are images built on M1 machines, because, as it turns out, Ubuntu helpfully has a multiplatform image, and Docker chooses arm
platform for M1 builds, while our deployment infrastructure, of course, remains on amd64
.
We could go and edit every single Dockerfile to use
FROM --platform=linux/amd64 ubuntu:20.04 as base
and that fixes the problem, but this is very annoying, we have a lot of Dockerfiles. Is there some way to force Docker to always use amd64
platform for multiplatform images on the build side?
One of the advantages of Docker has been - no matter where you build it, you get the predictable image. Now this assumption is broken, we'd like to restore it.