Path: blob/master/website/content/en/docs/config/multi-arch.md
2622 views
------Lima supports several modes for running Intel-on-ARM and ARM-on-Intel:
Slow mode: Intel VM on ARM Host / ARM VM on Intel Host
| ⚡ Requirement | QEMU, lima-additional-guestagents |
|---|
Lima can run a VM with a foreign architecture, using QEMU.
For port forwarding, the lima-additional-guestagents package has to be installed on the host.
An example configuration: {{< tabpane text=true >}} {{% tab header="CLI" %}}
See the YAML tab for the explanation of the corresponding CLI flags. {{% /tab %}} {{% tab header="YAML" %}}
{{% /tab %}} {{< /tabpane >}}
Running a VM with a foreign architecture is extremely slow. Consider using Fast mode or Fast mode 2 whenever possible.
Fast mode: Intel containers on ARM VM on ARM Host / ARM containers on Intel VM on Intel Host
This mode uses QEMU User Mode Emulation. QEMU User Mode Emulation is significantly faster than QEMU System Mode Emulation, but it often sacrifices compatibility.
Set up:
Run containers:
Build and push container images:
See also https://github.com/containerd/nerdctl/blob/main/docs/multi-platform.md
Fast mode 2 (Rosetta): Intel containers on ARM VM on ARM Host
| ⚡ Requirement | Lima >= 0.14, macOS >= 13.0, ARM |
|---|
Rosetta is known to be much faster than QEMU User Mode Emulation. Rosetta is available for VZ instances on ARM hosts.
{{< tabpane text=true >}} {{% tab header="CLI" %}}
{{% /tab %}} {{% tab header="YAML" %}}
{{% /tab %}} {{< /tabpane >}}
Enable Rosetta AOT Caching with CDI spec
| ⚡ Requirement | Lima >= 2.0, macOS >= 14.0, ARM |
|---|
Rosetta AOT Caching speeds up containers by saving translated binaries, so they don't need to be translated again. Learn more: WWDC2023 video
How to use Rosetta AOT Caching:
Run a container: Add
--device=lima-vm.io/rosetta=cachedto yourdocker runcommand:Build an image: Add
# syntax=docker/dockerfile:1-labsat the top of your Dockerfile to enable the--deviceoption. Use--device=lima-vm.io/rosetta=cachedin yourRUNcommand:Check if caching works: Look for cache files in the VM:
Check if Docker recognizes the CDI device: Look for CDI info in the output of
docker info:Learn more about CDI: CDI spec documentation