operator-registry icon indicating copy to clipboard operation
operator-registry copied to clipboard

Unable to specify a platform when generating an index image via opm using podman as a build tool

Open tinaselenge opened this issue 3 years ago • 1 comments

There is no option to specify a platform when generating an index image via opm using podman as a build tool. This is a problem when trying to generate linux/amd64 compatible images on m1 mac. For example, I built a bundle image that is compatible with linux/amd64:

podman build -t <BUNDLE_IMAGE> --platform=linux/amd64 . 

Then generated an index image for it:

 opm index add --bundles <BUNDLE_IMAGE> --tag <INDEX_IMAGE>

When running the image in a cluster, the container crashes due to exec /bin/opm: exec format error . We think this is because the index image was built on linux/arm64 instead of linux/amd64.

When choosing docker as a build tool in the opm command, this doesn't seem to be a problem if you set the following docker env variable:

export DOCKER_DEFAULT_PLATFORM=linux/amd64

However this env variable does not seem to take an effect for podman. You have to set --platform option in the podman command.

tinaselenge avatar Oct 25 '22 15:10 tinaselenge