engine: add platform field to EngineConfig#2542
Closed
TrevorBurnham wants to merge 1 commit intocontainers:mainfrom
Closed
engine: add platform field to EngineConfig#2542TrevorBurnham wants to merge 1 commit intocontainers:mainfrom
TrevorBurnham wants to merge 1 commit intocontainers:mainfrom
Conversation
Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
|
This repository has been migrated to https://github.com/containers/container-libs. Please open your PR there. |
Author
|
Whoops! Opened as containers/container-libs#669. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: containers/podman#25641
This PR adds a new
platformoption to the[engine]section ofcontainers.conf:This allows users to set a default platform (
os/archoros/arch/variant) for image operations such as pull, build, run, and create.Why
Users currently have no way to globally default to a different platform. This forces workarounds for tools that don't expose
--platformflags. Docker supports this viaDOCKER_DEFAULT_PLATFORM, but Podman has no equivalent config or env var.This PR provides the
containers/commonfoundation. A follow-up PR incontainers/podmanwill wire this into pull/build/run/create and addDOCKER_DEFAULT_PLATFORMenv var support for Docker compatibility.Changes
pkg/config/config.go: AddedPlatformfield toEngineConfigwithtoml:"platform"tagpkg/config/config.go: AddedPlatformComponents()method to parse the field intoos,arch,variantpkg/config/config.go: AddedvalidatePlatform()and wired it intoEngineConfig.Validate()docs/containers.conf.5.md: Documented the newplatformoption in the[engine]tablepkg/config/config_test.go: Added tests for valid/invalid platforms, empty default, and component parsingpkg/config/testdata/containers_override.conf: Addedplatformto the override test fixtureValidation
The
platformstring is validated on config load:os/archoros/arch/variant(e.g.,linux/amd64,linux/arm64/v8)linux), trailing slashes (linux/amd64/), and missing components (/amd64)