Skip to content

Commit 474906d

Browse files
iko1jglogan
andauthored
feat: Add runtime flag to container create and run commands (apple#1049) (apple#1109)
## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context Fixes apple#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>
1 parent 40de343 commit 474906d

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

Sources/Services/ContainerAPIService/Client/Flags.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ public struct Flags {
221221

222222
@Flag(name: .long, help: "Mount the container's root filesystem as read-only")
223223
public var readOnly = false
224+
225+
@Option(name: .long, help: "Set the runtime handler for the container (default: container-runtime-linux)")
226+
public var runtime: String?
224227
}
225228

226229
public struct Progress: ParsableArguments {

Sources/Services/ContainerAPIService/Client/Utility.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public struct Utility {
248248
config.ssh = management.ssh
249249
config.readOnly = management.readOnly
250250

251+
if let runtime = management.runtime {
252+
config.runtimeHandler = runtime
253+
}
254+
251255
return (config, kernel)
252256
}
253257

docs/command-reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ container run [<options>] <image> [<arguments> ...]
6565
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
6666
* `-v, --volume <volume>`: Bind mount a volume into the container
6767
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)
68+
* `--runtime`: Set the runtime handler for the container (default: container-runtime-linux)
6869

6970
**Registry Options**
7071

@@ -214,6 +215,7 @@ container create [<options>] <image> [<arguments> ...]
214215
* `--tmpfs <tmpfs>`: Add a tmpfs mount to the container at the given path
215216
* `-v, --volume <volume>`: Bind mount a volume into the container
216217
* `--virtualization`: Expose virtualization capabilities to the container (requires host and guest support)
218+
* `--runtime`: Set the runtime handler for the container (default: container-runtime-linux)
217219

218220
**Registry Options**
219221

0 commit comments

Comments
 (0)