Skip to content

Use containers.conf engine.platform as default platform#6698

Draft
TrevorBurnham wants to merge 2 commits intocontainers:mainfrom
TrevorBurnham:engine-default-platform
Draft

Use containers.conf engine.platform as default platform#6698
TrevorBurnham wants to merge 2 commits intocontainers:mainfrom
TrevorBurnham:engine-default-platform

Conversation

@TrevorBurnham
Copy link
Copy Markdown

@TrevorBurnham TrevorBurnham commented Feb 25, 2026

Depends on: containers/container-libs#669

What type of PR is this?

/kind feature

What this PR does / why we need it:

When no --platform, --os, --arch, or --variant flags are specified, fall back to the platform value from containers.conf [engine] section.

How to verify it

  1. Set a non-native platform in containers.conf
  2. Run a pull without using the --platform flag

For example:

# containers.conf
[engine]
platform = "linux/s390x"
buildah pull alpine
buildah inspect --format '{{.OCIv1.Architecture}}' alpine

Expect: s390x

Which issue(s) this PR fixes:

Related to containers/podman#25641

Does this PR introduce a user-facing change?

Yes:

Buildah now respects the `platform` setting in the `[engine]` section of `containers.conf`. Explicit `--platform`, `--os`, `--arch`, or `--variant` flags continue to take precedence.

@packit-as-a-service
Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

@nalind
Copy link
Copy Markdown
Member

nalind commented Feb 25, 2026

Try adding this to the end of the top-level go.mod:

replace (
	go.podman.io/storage => github.com/TrevorBurnham/container-libs/storage add-engine-platform-config
	go.podman.io/image/v5 => github.com/TrevorBurnham/container-libs/image/v5 add-engine-platform-config
	go.podman.io/common => github.com/TrevorBurnham/container-libs/common add-engine-platform-config
)

followed by a go mod tidy && go mod vendor to pull in the changes from container-libs.

@TrevorBurnham TrevorBurnham force-pushed the engine-default-platform branch 3 times, most recently from 6219a24 to a336f70 Compare February 27, 2026 00:34
@TomSweeneyRedHat
Copy link
Copy Markdown
Member

@TrevorBurnham looks like this needs a rebase now.

assert $status -eq 0
alg="${output%%:*}"
hex="${output##*:}"
run jq -r '.os' "$TEST_SCRATCH_DIR"/output/blobs/"$alg"/"$hex"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section can probably set local config="$TEST_SCRATCH_DIR"/output/$(oci_image_config "$TEST_SCRATCH_DIR"/output), and then point jq at "$config".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

cat >${TEST_SCRATCH_DIR}/containers.conf << EOF
[engine]
platform = "linux/amd64"
EOF
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our tests run on amd64, so I'm not sure that this ensures that we're using the value from the configuration file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I've switched to linux/arm64 so the test actually verifies that the config is being used.

@TrevorBurnham TrevorBurnham force-pushed the engine-default-platform branch from a336f70 to 8afa014 Compare March 25, 2026 00:55
When no --platform, --os, --arch, or --variant flags are specified,
fall back to the platform value from containers.conf [engine] section.
This allows users to set a default platform for all image operations
(pull, build, from) without passing flags each time.

Depends on: containers/container-libs#669

Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
Replace go.podman.io/common, go.podman.io/image/v5, and
go.podman.io/storage with TrevorBurnham/container-libs@add-engine-platform-config
to test the new engine platform config field in buildah CI.

Depends on: containers/container-libs#669

Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
@TrevorBurnham TrevorBurnham force-pushed the engine-default-platform branch from 8afa014 to 5a58086 Compare April 7, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants