I’ve got a mix of architectures in my basement cluster - some Odroid HC2s that are arm7, some Raspberry Pi 4s that are arm64, and am soon going to add an Intel node as well. It’s more hassle than it’s worth to have to specify different images for the different architectures. I already build my own copies of images, so I decided to start building all my images as multiarchitecture images.

This turned out to be a lot easier than I was expecting - recent stable builds (2.0.4.0 (33772) or higher) of Docker Desktop can build for other architectures by running virtual machines in QEMU, so I can do the whole build on my MacBook Pro instead of baking each architecture separately and stitching them together with a manifest file.

  1. Install the latest Docker Desktop for macOS
  2. Enable experimental mode either by setting DOCKER_CLI_EXPERIMENTAL=enabled in your environment or by adding "experimental" : "enabled" to ~/.docker/config.json
  3. Do docker buildx ls to see the current builders
  4. docker buildx create --name multiarch
  5. docker buildx use multiarch
  6. docker buildx inspect --bootstrap

Now you’re ready to build. Go into one of your docker projects, then do docker buildx --platform linux/amd64,linux/arm64,linux/arm/v7 -t username/demo --push .

If you’re not ready to push your image to docker hub, do --load instead of --push to have it build the image and copy it out of the buildx system and into your local docker.

  • Edit - documented enabling Docker’s experimental mode