Docker’s official documentation on how to enable multi-platform Docker builds is a bit intimidating, suggesting you to run the Docker image
tonistiigi/binfmt in privileged mode on your machine. I searched for alternatives on Ubuntu, and found this very detailed description. However, with recent versions of Ubuntu and Docker, it is now much easier than that:
- Install QEMU’s static user mode emulation binaries:
sudo apt install qemu-user-static
- Install Docker Engine with Buildx support according instructions here (do not install
docker.iofrom Ubuntu’s standard repository).
- Create a Docker Buildx builder:
docker buildx create --name multiplatform --bootstrap --use
- Verify it:
docker buildx inspect
Then you can do multi-platform Docker builds like this:
docker buildx build --platform linux/amd64,linux/arm64 .