Add virtualization support for containers#377
Merged
dcantah merged 1 commit intoapple:mainfrom Jul 30, 2025
Merged
Conversation
da1fa0a to
fe6849d
Compare
jglogan
requested changes
Jul 30, 2025
Sources/ContainerClient/Flags.swift
Outdated
| @Flag( | ||
| name: [.customLong("virt")], | ||
| help: | ||
| "Expose virtualization capabilities to the container. (Host must have nested virtualization support, and guest kernel must have virtualization capabilities enabled" |
Contributor
There was a problem hiding this comment.
Missing closing parenthesis.
Closes apple#376 On supported SoCs virtualization.framework has nested virtualization support, and it's already exposed in Containerization. This exposes a --virtualization flag on create and run to expose this to users here. If the host doesn't support it we'll fail when going to run the container. The guest kernel also must have virtualization enabled, which our default kernel does not. ``` ./bin/container run -it --rm --virtualization ubuntu:latest bash Error: unsupported: "nested virtualization is not supported on the platform" ``` And a successful run with a supplied kernel: ``` ./bin/container run --rm --virtualization -it --kernel ~/Downloads/kernel.arm64 ubuntu:latest sh -c "dmesg | grep kvm" [ 0.017245] kvm [1]: IPA Size Limit: 40 bits [ 0.017499] kvm [1]: GICv3: no GICV resource entry [ 0.017501] kvm [1]: disabling GICv2 emulation [ 0.017506] kvm [1]: GIC system register CPU interface enabled [ 0.017685] kvm [1]: vgic interrupt IRQ9 [ 0.017893] kvm [1]: Hyp mode initialized successfully ```
jglogan
approved these changes
Jul 30, 2025
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.
Closes #376
On supported SoCs virtualization.framework has nested virtualization
support, and it's already exposed in Containerization. This exposes
a --virt flag on create and run to expose this to users here. If
the host doesn't support it we'll fail when going to run the container.
The guest kernel also must have virtualization enabled, which our default
kernel does not so one must be supplied.
And a successful run with a supplied kernel: