feat: Add runtime flag to container create and run commands (#1049) (#1109)

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

## Motivation and Context
Fixes #1049 
-  Add --runtime option for Flags.Management
-  Apply runtime handler in containerConfigFromFlags
-  Update command-reference.md doc

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs

Co-authored-by: J Logan <john_logan@apple.com>
This commit is contained in:
Amir Alperin
2026-02-06 13:38:19 -08:00
committed by GitHub
co-authored by J Logan
parent 40de3430cd
commit 474906daf9
3 changed files with 9 additions and 0 deletions
@@ -221,6 +221,9 @@ public struct Flags {
@Flag(name: .long, help: "Mount the container's root filesystem as read-only")
public var readOnly = false
@Option(name: .long, help: "Set the runtime handler for the container (default: container-runtime-linux)")
public var runtime: String?
}
public struct Progress: ParsableArguments {
@@ -248,6 +248,10 @@ public struct Utility {
config.ssh = management.ssh
config.readOnly = management.readOnly
if let runtime = management.runtime {
config.runtimeHandler = runtime
}
return (config, kernel)
}
+2
View File
@@ -65,6 +65,7 @@ container run [<options>] <image> [<arguments> ...]
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
* `-v, --volume <volume>`: Bind mount a volume into the container
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)
* `--runtime`: Set the runtime handler for the container (default: container-runtime-linux)
**Registry Options**
@@ -214,6 +215,7 @@ container create [<options>] <image> [<arguments> ...]
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
* `-v, --volume <volume>`: Bind mount a volume into the container
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)
* `--runtime`: Set the runtime handler for the container (default: container-runtime-linux)
**Registry Options**