Linux virtual machines, typically on macOS, for running containerd
Lima launches Linux virtual machines with automatic file sharing and port forwarding (similar to WSL2), and containerd.
Lima can be considered as a some sort of unofficial “containerd for Mac”.
Containerd is available as a daemon for Linux and Windows. It manages the complete container lifecycle of its host system, from image transfer and storage to container execution and supervision to low-level storage to network attachments and beyond.
Lima is expected to be used on macOS hosts, but can be used on Linux hosts as well.
- Automatic file sharing
- Automatic port forwarding
- Built-in support for containerd (Other container engines can be used too)
- Intel on Intel
- ARM on Intel
- ARM on ARM
- Intel on ARM
- Various guest Linux distributions: AlmaLinux, Alpine, Arch Linux, Debian, Fedora, openSUSE, Rocky, Ubuntu (default).
The goal of Lima is to promote containerd including nerdctl (contaiNERD ctl) to Mac users, but Lima can be used for non-container applications as well.
- Rancher Desktop: Kubernetes and container management to the desktop
- Colima: Docker (and Kubernetes) on macOS with minimal setup
Lima xbar plugin: xbar plugin to start/stop VMs from the menu bar and see their running status.
lima-gui: Qt GUI for Lima
#lima channel, colocated with #rancher-desktop channel in Rancher Users Slack (Lima is not a Rancher project)
New account: https://slack.rancher.io/
$ uname -a
Darwin macbook.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64
$ lima uname -a
Linux lima-default 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ LIMA_INSTANCE=arm lima uname -a
Linux lima-arm 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:10:16 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
See ./docs/multi-arch.md for Intel-on-ARM and ARM-on-Intel .
Sharing files across macOS and Linux
$ echo “files under /Users on macOS filesystem are readable from Linux” > some-file
$ lima cat some-file
files under /Users on macOS filesystem are readable from Linux
$ lima sh -c ‘echo “/tmp/lima is writable from both macOS and Linux” > /tmp/lima/another-file’
$ cat /tmp/lima/another-file
/tmp/lima is writable from both macOS and Linux
Running containerd containers (compatible with Docker containers)
$ lima nerdctl run -d –name nginx -p 127.0.0.1:8080:80 nginx:alpine
You don’t need to run “lima nerdctl” everytime, instead you can use special shortcut called “nerdctl.lima” to do the same thing. By default, it’ll be installed along with the lima, so, you don’t need to do anything extra. There will be a symlink called nerdctl pointing to nerdctl.lima. This is only created when there is no nerdctl entry in the directory already though.
It worths to mention that this is created only via make install. Not included in Homebrew/MacPorts/nix packages.
http://127.0.0.1:8080 is accessible from both macOS and Linux.
For the usage of containerd and nerdctl (contaiNERD ctl), visit https://github.com/containerd/containerd and https://github.com/containerd/nerdctl.
Homebrew package is available.
brew install lima
Manual installation steps
[macOS]$ limactl start ... INFO READY. Run `lima` to open the shell. [macOS]$ lima uname Linux
- Run limactl start <INSTANCE> [–tty=false] to start the Linux instance. The default instance name is “default”. Lima automatically opens an editor (vi) for reviewing and modifying the configuration. Wait until “READY” to be printed on the host terminal. –tty=false disables the interactive prompt to open an editor.
- Run limactl shell <INSTANCE> <COMMAND> to launch <COMMAND> on Linux. For the “default” instance, this command can be shortened as lima <COMMAND>. The lima command also accepts the instance name as the environment variable $LIMA_INSTANCE.
- Run limactl copy <SOURCE> … <TARGET> to copy files between instances, or between instances and the host. Use <INSTANCE>:<FILENAME> to specify a source or target inside an instance.
- Run limactl list [–json] to show the instances.
- Run limactl stop [–force] <INSTANCE> to stop the instance.
- Run limactl delete [–force] <INSTANCE> to delete the instance.
- Run limactl edit <INSTANCE> to edit the instance.
- To enable bash completion, add source <(limactl completion bash) to ~/.bash_profile.
- To enable zsh completion, see limactl completion zsh –help
CAUTION: make sure to back up your data
Lima may have bugs that result in loss of data.
Make sure to back up your data before running Lima.
Especially, the following data might be easily lost:
- Data in the shared writable directories (/tmp/lima by default), probably after hibernation of the host machine (e.g., after closing and reopening the laptop lid)
- Data in the VM image, mostly when upgrading the version of lima
The current default spec:
- OS: Ubuntu 21.10 (Impish Indri)
- CPU: 4 cores
- Memory: 4 GiB
- Disk: 100 GiB
- Mounts: ~ (read-only), /tmp/lima (writable)
- SSH: 127.0.0.1:60022
How it works
Hypervisor: QEMU with HVF accelerator
Filesystem sharing: reverse sshfs (likely to be replaced with 9p or Samba in future)
Port forwarding: ssh -L, automated by watching /proc/net/tcp and iptables events in the guest