From 474906daf9c8d7d97fa642df973924baff7cf900 Mon Sep 17 00:00:00 2001 From: Amir Alperin Date: Fri, 6 Feb 2026 23:38:19 +0200 Subject: [PATCH] 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 --- Sources/Services/ContainerAPIService/Client/Flags.swift | 3 +++ Sources/Services/ContainerAPIService/Client/Utility.swift | 4 ++++ docs/command-reference.md | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Sources/Services/ContainerAPIService/Client/Flags.swift b/Sources/Services/ContainerAPIService/Client/Flags.swift index e64ce927..86616a03 100644 --- a/Sources/Services/ContainerAPIService/Client/Flags.swift +++ b/Sources/Services/ContainerAPIService/Client/Flags.swift @@ -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 { diff --git a/Sources/Services/ContainerAPIService/Client/Utility.swift b/Sources/Services/ContainerAPIService/Client/Utility.swift index 22fcb8fb..a57383aa 100644 --- a/Sources/Services/ContainerAPIService/Client/Utility.swift +++ b/Sources/Services/ContainerAPIService/Client/Utility.swift @@ -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) } diff --git a/docs/command-reference.md b/docs/command-reference.md index e799fa28..507971a3 100644 --- a/docs/command-reference.md +++ b/docs/command-reference.md @@ -65,6 +65,7 @@ container run [] [ ...] * `--tmpfs `: Add a tmpfs mount to the container at the given path * `-v, --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 [] [ ...] * `--tmpfs `: Add a tmpfs mount to the container at the given path * `-v, --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**