Use podman to build linux/amd64 image failed on Macbook Pro M3

Lately, I’ve been trying to deploy a small service to GCP Cloud Run. But since Cloud Run only supports linux/amd64 images (https://cloud.google.com/run/docs/container-contract), I need to add an extra parameter when building the image: –platform=linux/amd64.


Lately, I’ve been trying to deploy a small service to GCP Cloud Run. But since Cloud Run only supports linux/amd64 images (https://cloud.google.com/run/docs/container-contract), I need to add an extra parameter when building the image: –platform=linux/amd64.

I used to build container images with Docker, but since company policy no longer allows Docker Desktop, I’ve been using Podman on my machine for the past few years. Turns out, when I just wanted to build an image specifically for the linux/amd64 architecture this time, I realized Podman couldn’t handle it.

The screenshot below shows the result of building an open liberty linux/amd64 image on my MacBook Pro M3 (using Podman version 5.6.0). As you can see, it fails at the last step when running RUN feature.sh:


Based on what I found on Google and tips from ChatGPT, here are the recommendations:

  • Build on an x86 machine: This definitely works. I tested on a 2019 MacBook Pro and the linux/amd64 image built fine. Even building a linux/arm64 image on that x86 MBP worked without issues (same Podman version).
  • Switch to a HotSpot JVM: This one surprised me. Open Liberty doesn’t provide an official HotSpot image except for Java 8 (and that’s IBM Java, not OpenJDK). Since there’s no official image (so no RUN features.sh), I’m not trying this option for now.
  • Use buildx instead of build: Docker’s buildx can build multi-platform images in one go. Podman also has buildx, but unlike Docker, in Podman it’s basically just an alias for build.

Right now it looks like Podman on ARM has trouble building linux/amd64 images, whereas building linux/arm64 on x86 is fine. Docker handles both directions without a problem. Podman’s got some catching up to do.

markkwsu

markkwsu

Add comment