diff --git a/README.md b/README.md index 6926b2cf..45809ce9 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ - Support for multiple container runtimes - [Docker](https://docker.com) (with optional Kubernetes) - [Containerd](https://containerd.io) (with optional Kubernetes) - - [Incus](https://linuxcontainers.org/incus) (containers and virtual machines [soon](https://github.com/lima-vm/lima/pull/2530) ) + - [Incus](https://linuxcontainers.org/incus) (containers and virtual machines) ## Getting Started @@ -117,6 +117,7 @@ Incus client is required for Incus runtime. Installable with brew `brew install You can use the `incus` client on macOS after `colima start` with no additional setup. +**Note:** Running virtual machines on Incus is only supported on m3 or newer Apple Silicon devices. ### None diff --git a/cmd/start.go b/cmd/start.go index 0f2a6de9..600ae7b7 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -18,6 +18,7 @@ import ( "github.com/abiosoft/colima/embedded" "github.com/abiosoft/colima/environment" "github.com/abiosoft/colima/environment/container/docker" + "github.com/abiosoft/colima/environment/container/incus" "github.com/abiosoft/colima/environment/container/kubernetes" "github.com/abiosoft/colima/util" "github.com/abiosoft/colima/util/osutil" @@ -145,7 +146,7 @@ func init() { defaultVMType = environment.DefaultVMType() mounts := strings.Join([]string{defaultMountTypeQEMU, "9p", "virtiofs"}, ", ") - types := strings.Join([]string{defaultVMType, "vz"}, ", ") + types := strings.Join([]string{"qemu", "vz"}, ", ") saveConfigDefault := true if envSaveConfig.Exists() { @@ -286,6 +287,15 @@ func setFlagDefaults(cmd *cobra.Command) { } } } + + // always enable nested virtualization for incus, if supported and not explicitly disabled. + if util.MacOSNestedVirtualizationSupported() { + if !cmd.Flag("nested-virtualization").Changed { + if startCmdArgs.Runtime == incus.Name && startCmdArgs.VMType == "vz" { + startCmdArgs.NestedVirtualization = true + } + } + } } func setConfigDefaults(conf *config.Config) { diff --git a/embedded/images/images.txt b/embedded/images/images.txt index fe91b474..76334f8e 100644 --- a/embedded/images/images.txt +++ b/embedded/images/images.txt @@ -1,8 +1,8 @@ -arm64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 837236b93ef520ee63f559a893b212df93ba42098d2f7b384fcdc4d7f38b28701498023cac23d2197dd3ae4eb5c7104e7506cae3679d25e055c2127d8f1aece4 ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 -arm64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 3a4e66446d953b5ab612c4ef8c2d7ca9d07c180216c436a4afe15cdcd94e0736de48e4779ce85f9190f22fa918719259710971dbb215c73d15addb6bf23b280c ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 -arm64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 6946bcc5829d5373cc6ce7777c618ee22dce27e4a57a1d7502b0e9053ad95bbe901065f60e487ded5d386f9cd8bc333fc91201958c0a5d0cf8a42741cf73ef77 ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 -arm64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 2f0ba625799ddddd6d2112ed7a4c6d21c5d1d847af104a9ad723a7dba1ee5e04819c2a8c60b84549df96a01bc006a2b97c4dd3fd283de476ecfc16b394b8b1d8 ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 -amd64 none https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 14075a7def430ef2632a93974b2cd8f7ba9e40cf96074d09b254ab9d4480c8be870922970ae72f236f0b14f5282a89d46d95b8eab89d8bef16d9b1d8d216a0d6 ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 -amd64 docker https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 1e128da890e9d8b07a3c2556fe200ce3c724108d099eacce311b520507f6e2d114430991d1b68ecf9ad66a915eb315f433a950bdff09450224c34d9529b88890 ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 -amd64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 a3f2ed75afc52fbf769215ef2b87a5f75ef2ac96bf620c566c93305e5d3aca32a1be38ebf511b6edd9e15a96dc987d7c71e4c482d64f21134e335cad6da3c148 ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 -amd64 incus https://github.com/abiosoft/colima-core/releases/download/v0.7.6-1/ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 9e04ab8d61559267010dc6f5315020abbaf14bd4cee91a2021ad30178255cfa85a962c0ffeb8759afedbe88ba8cac90963cfa3756d56974c5db2e21eb21e0700 ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 +arm64 none https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 3e31af38cb236cb2a4382e153131b65ef29ca6f0c456908fe062539df3dbe209ccfac958452dc58054dcb3dc86554cbd1916d83475880b020d77a78a9af5f831 ubuntu-24.04-minimal-cloudimg-arm64-none.qcow2 +arm64 docker https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 e14436f5ae363371dee443445c013ddb53c4339bbc02db72676fe55b40394293eb59902d8f701ab7694f9932bf9b9c9a3ef7488c17d41d055d43123ecd129f30 ubuntu-24.04-minimal-cloudimg-arm64-docker.qcow2 +arm64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 18326315fd850d7a0d216e928b1f9422da8012a2b8356003c1e6738e3c3a72a4f81515ea12350de65c39d3182492153e6447cc7230b5b60c253bc9183ccd3d8d ubuntu-24.04-minimal-cloudimg-arm64-containerd.qcow2 +arm64 incus https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 2cb937846c88a084554cc44afc3cbcae9093cf0943615cbc83e0d93afa2dda4b2e39c44c15998f164e77c4dc9b199ca29205c9e8a8546e7647259c5e4587e2d3 ubuntu-24.04-minimal-cloudimg-arm64-incus.qcow2 +amd64 none https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 2549c3f41bda18d1224e55f60f1ca743d91a079a8ea647aaf36d865700d8fc96f57d023487243b406b4c30345d9fe49a9b29bf05c001308af09452d8155882f2 ubuntu-24.04-minimal-cloudimg-amd64-none.qcow2 +amd64 docker https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 e8a6c02bbe5a312fc00e816f430a24340bfb42e8e7801f75c914c475ac335eaca484ae8abe344b8db316fe28a4342007850e7a6fc7e361f565c810e45089f843 ubuntu-24.04-minimal-cloudimg-amd64-docker.qcow2 +amd64 containerd https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 dd370395d4297d47a9adf4e3a1d6781e41a70e38fe59817fa05dfc16a118b32c83468f5b8fc881edafe5b211d4cfb6906712061ab00e9ef7fbcda940413ec8d0 ubuntu-24.04-minimal-cloudimg-amd64-containerd.qcow2 +amd64 incus https://github.com/abiosoft/colima-core/releases/download/v0.8.0/ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 ad643a44857f9b11de78977c03ece9cd339bbc6e3720e9063a6188d627b6ec6c7a5085224152e674852632c4c18265c502cd7bacda6874f3edbb1cea91784d2b ubuntu-24.04-minimal-cloudimg-amd64-incus.qcow2 diff --git a/embedded/images/images_sha.sh b/embedded/images/images_sha.sh index 01bf13a7..abc57016 100644 --- a/embedded/images/images_sha.sh +++ b/embedded/images/images_sha.sh @@ -4,7 +4,7 @@ set -eux BASE_URL=https://github.com/abiosoft/colima-core/releases/download BASE_FILENAME=ubuntu-24.04-minimal-cloudimg -VERSION=v0.7.6-1 +VERSION=v0.8.0 RUNTIMES="none docker containerd incus" ARCHS="arm64 amd64" diff --git a/util/macos.go b/util/macos.go index 9de1073a..0f826c95 100644 --- a/util/macos.go +++ b/util/macos.go @@ -31,7 +31,7 @@ func MacOS15OrNewer() bool { return minMacOSVersion("15.0.0") } // MacOSNestedVirtualizationSupported returns if the current device supports nested virtualization. func MacOSNestedVirtualizationSupported() bool { - return M3() && MacOS15OrNewer() + return (IsMx(3) || IsMx(4)) && MacOS15OrNewer() } func minMacOSVersion(version string) bool { @@ -53,8 +53,9 @@ func minMacOSVersion(version string) bool { return cver.Compare(*ver) <= 0 } -// M3 returns if the current device is an Apple M3 device. -func M3() bool { +// IsMx returns if the current device is an Apple Silicon Mx device +// where x is the number e.g. x = 1 --> m1, x = 3 --> m3 e.t.c. +func IsMx(x int) bool { var resp struct { SPHardwareDataType []struct { ChipType string `json:"chip_type"` @@ -80,7 +81,7 @@ func M3() bool { } chipType := strings.ToUpper(resp.SPHardwareDataType[0].ChipType) - return strings.Contains(chipType, "M3") + return strings.Contains(chipType, fmt.Sprintf("M%d", x)) } // RosettaRunning checks if Rosetta process is running.