Skip to content

Conversation

@jglogan
Copy link
Contributor

@jglogan jglogan commented Aug 27, 2025

  • Fixes [Request]: container run/container create should support a --platform=<OS>/<ARCH> flag #231.
  • Extends CLI: Add --platform flag #313 (@dcantah) so that all of container create, container run, container build, container image pull, and container image save accept the three options.
  • container build now processes comma-separated lists for --platform, --arch, and --os. It first checks --platform, assembling the union of all platform values. If that set is non-empty, the builder builds the values in the set. Otherwise, the set consists of all combinations of the specified architecture and os values, finally defaulting to linux and the host architecture if no options are provided.
  • All other commands work accept a single platform, preferring the --platform option over --arch and --os when both are specified. --os defaults to linux, and --arch defaults to the host architecture.
  • Clarify help messages and present the args in consistent order, with platform first since it takes precedence if present.
  • Deduplicate redundant platform options for container build.

@dcantah
Copy link
Contributor

dcantah commented Aug 27, 2025

Needs a make fmt

@jglogan jglogan force-pushed the users/jglogan/cli-platform branch from 39a1c58 to f0bddec Compare August 27, 2025 01:34
Copy link
Contributor

@egernst egernst left a comment

Choose a reason for hiding this comment

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

Thanks John. lgtm

@egernst egernst mentioned this pull request Aug 27, 2025
@jglogan jglogan force-pushed the users/jglogan/cli-platform branch from 40f4d36 to a3b4852 Compare August 27, 2025 16:50
Fixes apple#231 (credit: @dcantah)

--platform is useful as it's what most folks are used to
from other container tools. We support two separate flags today
that when combined (--os and --arch) do essentially the same thing,
but this is a combined single string form.
- Ensure `create`, `run`, `build`, `image pull`, and
  `image save` have consistent options, option order,
  and help messages.
- Accept comma-separated lists in `container build`.
- Deduplicate the final platform list in
  `container build`.
@jglogan jglogan force-pushed the users/jglogan/cli-platform branch from a3b4852 to 679ea01 Compare August 27, 2025 19:34
@jglogan jglogan force-pushed the users/jglogan/cli-platform branch from 677d473 to 15e49ff Compare August 27, 2025 19:56
@jglogan jglogan merged commit a8c779f into apple:main Aug 27, 2025
2 checks passed
jglogan added a commit to jglogan/container that referenced this pull request Sep 9, 2025
- Reverts an inadvertent "fix" from apple#545.
- Closes apple#592.
jglogan added a commit to jglogan/container that referenced this pull request Sep 10, 2025
- Reverts an inadvertent "fix" from apple#545.
- Closes apple#592.
jglogan added a commit that referenced this pull request Sep 10, 2025
- Reverts an inadvertent "fix" from #545.
- Closes #592.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
See #592 

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
@jglogan jglogan deleted the users/jglogan/cli-platform branch September 10, 2025 17:23
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.

[Request]: container run/container create should support a --platform=<OS>/<ARCH> flag

3 participants