### Start Fedora VM for manual setup Source: https://lima-vm.io/docs/config/vmtype/krunkit Initialize a Fedora-based VM using the krunkit driver. ```bash limactl start --vm-type=krunkit template:fedora limactl shell fedora ``` -------------------------------- ### Start a Lima instance Source: https://lima-vm.io/docs/reference/limactl_start Basic usage examples for starting instances using default settings or specific templates. ```bash To create an instance "default" (if not created yet) from the default Ubuntu template, and start it: $ limactl start To create an instance "default" from a template "docker", and start it: $ limactl start --name=default template:docker ``` -------------------------------- ### Create and start a template instance Source: https://lima-vm.io/docs/templates Initializes a new instance from the fedora template and starts it. ```bash # Note: In Lima 1.x, template URLs included leading slashes, e.g. `template://fedora`. limactl create template:fedora limactl start fedora ``` ```bash limactl start template:fedora # For the second time onward, just run `limactl start fedora` ``` -------------------------------- ### Create and start a custom instance Source: https://lima-vm.io/docs/usage Creates a named instance from a specific template and starts it. ```bash limactl create --name=default template:docker limactl start default ``` -------------------------------- ### Install and run OpenCode Source: https://lima-vm.io/docs/examples/ai Installs OpenCode using npm. ```bash lima sudo snap install node --classic lima sudo npm install -g opencode-ai lima opencode ``` -------------------------------- ### Start Instance in Plain Mode via CLI Source: https://lima-vm.io/docs/config/_print Use the --plain flag during the start command to initialize an instance in plain mode. ```bash limactl start --plain ``` -------------------------------- ### Start FreeBSD Guest Templates Source: https://lima-vm.io/docs/usage/guests/_print Commands to initialize FreeBSD 15 or 16 guest instances. ```bash limactl start template:freebsd-15 ``` ```bash limactl start template:experimental/freebsd-16 ``` -------------------------------- ### Start krunkit VM and shell Source: https://lima-vm.io/docs/config/vmtype/krunkit Initialize the VM using the krunkit driver and enter the shell. ```bash limactl start --vm-type=krunkit limactl shell default ``` -------------------------------- ### Create a snapshot example Source: https://lima-vm.io/docs/reference/limactl_snapshot_create An example command to create a snapshot named 'snap1' for the 'default' instance. ```bash Create a snapshot of an instance: $ limactl snapshot create default --tag snap1 ``` -------------------------------- ### Copying templates examples Source: https://lima-vm.io/docs/reference/limactl_template_copy Examples showing how to copy templates to stdout or from a web location with embedding. ```bash # Copy default template to STDOUT limactl template copy template:default - # Copy template from web location to local file and embed all external references # (this does not embed template: references) limactl template copy --embed https://example.com/lima.yaml mighty-machine.yaml ``` -------------------------------- ### View Available Plugins Source: https://lima-vm.io/docs/config/plugin/cli Example output showing discovered plugins in the help menu. ```text Available Plugins (Experimental): ps Sample limactl-ps alias that shows running instances sh ``` -------------------------------- ### Install socket_vmnet from source Source: https://lima-vm.io/docs/config/network/vmnet Commands to clone, build, and install socket_vmnet to a secure root-owned directory. ```bash # Install socket_vmnet as root from source to /opt/socket_vmnet # using instructions on https://github.com/lima-vm/socket_vmnet # This assumes that Xcode Command Line Tools are already installed git clone https://github.com/lima-vm/socket_vmnet cd socket_vmnet # Change "v1.2.2" to the actual latest release in https://github.com/lima-vm/socket_vmnet/releases git checkout v1.2.2 make sudo make PREFIX=/opt/socket_vmnet install.bin # Set up the sudoers file for launching socket_vmnet from Lima limactl sudoers >etc_sudoers.d_lima less etc_sudoers.d_lima # verify that the file looks correct sudo install -o root etc_sudoers.d_lima /etc/sudoers.d/lima rm etc_sudoers.d_lima ``` -------------------------------- ### Interactive rebase commit configuration examples Source: https://lima-vm.io/docs/dev/git Examples showing the transition from multiple pick commands to using fixup for cleaner commit history. ```text pick aaaaaaa First commit message pick bbbbbbb Second commit message pick ccccccc Fix typo ``` ```text pick aaaaaaa First commit message f bbbbbbb Second commit message f ccccccc Fix typo ``` -------------------------------- ### Start Windows 11 VM Source: https://lima-vm.io/docs/usage/guests/windows Initializes a Windows 11 guest instance using the default template. ```bash limactl start template:windows ``` -------------------------------- ### Install and run Aider Source: https://lima-vm.io/docs/examples/ai Installs Aider via pipx and configures the environment path. ```bash lima sudo apt install -y pipx lima pipx install aider-install lima sh -c 'echo "export PATH=$PATH:$HOME/.local/bin" >>~/.bash_profile' lima aider-install lima aider ``` ```bash lima vi "/home/${USER}.linux/.bash_profile" ``` -------------------------------- ### Build and Install Lima from Source Source: https://lima-vm.io/docs/installation/source Standard commands to clone the repository and install Lima to the system path. ```bash git clone https://github.com/lima-vm/lima cd lima make sudo make install ``` -------------------------------- ### Install krunkit via Homebrew Source: https://lima-vm.io/docs/config/vmtype/krunkit Commands to install the krunkit formula on the host machine. ```bash brew tap slp/krun brew install krunkit ``` -------------------------------- ### Start Homebrew macOS Guest Template Source: https://lima-vm.io/docs/usage/guests/macos Initializes a macOS guest environment pre-configured with Homebrew. ```bash limactl start template:homebrew-macos ``` -------------------------------- ### List snapshots examples Source: https://lima-vm.io/docs/reference/limactl_snapshot_list Common usage examples for listing all snapshots or only the snapshot tags. ```bash List all snapshots of an instance: $ limactl snapshot list default List only snapshot tags: $ limactl snapshot list default --quiet ``` -------------------------------- ### Basic usage of limactl autostart enable Source: https://lima-vm.io/docs/reference/limactl_autostart_enable Syntax for registering an instance to start automatically. ```bash limactl autostart enable INSTANCE [flags] ``` -------------------------------- ### Start instance with network Source: https://lima-vm.io/docs/config/network/vmnet Command to start a Lima instance using a specific network. ```bash limactl start --network=lima:shared ``` -------------------------------- ### Start Windows Guest Templates Source: https://lima-vm.io/docs/usage/guests/_print Commands to initialize Windows 11 or Windows Server 2025 guest instances. ```bash limactl start template:windows ``` ```bash limactl start template:windows-2025 ``` -------------------------------- ### Install and run Codex Source: https://lima-vm.io/docs/examples/ai Installs Codex using npm and configures the API key. ```bash lima sudo snap install node --classic lima sudo npm install -g @openai/codex lima codex ``` ```bash lima vi "/home/${USER}.linux/.bash_profile" ``` -------------------------------- ### Install and run Gemini CLI Source: https://lima-vm.io/docs/examples/ai Installs Gemini CLI using npm and configures the API key. ```bash lima sudo snap install node --classic lima sudo npm install -g @google/gemini-cli lima gemini ``` ```bash lima vi "/home/${USER}.linux/.bash_profile" ``` -------------------------------- ### Initialize and run Apptainer Source: https://lima-vm.io/docs/examples/_print Commands to start rootless or rootful Apptainer templates and execute containers. ```bash limactl start template:apptainer limactl shell apptainer apptainer run -u -B $HOME:$HOME docker://alpine ``` ```bash limactl start template:apptainer-rootful limactl shell apptainer-rootful apptainer run -u -B $HOME:$HOME docker://alpine ``` -------------------------------- ### Resize a disk example Source: https://lima-vm.io/docs/reference/limactl_disk_resize Example command to resize a specific disk to a new size. ```bash limactl disk resize DISK --size SIZE ``` -------------------------------- ### Install and run GitHub Copilot Source: https://lima-vm.io/docs/examples/ai Installs GitHub Copilot CLI using npm and configures the authentication token. ```bash lima sudo snap install node --classic lima sudo npm install -g @github/copilot lima copilot ``` ```bash lima vi "/home/${USER}.linux/.bash_profile" ``` -------------------------------- ### Install GPU support script Source: https://lima-vm.io/docs/config/vmtype/krunkit Bash script to install Vulkan drivers and build llama.cpp from source. ```bash #!/bin/bash # SPDX-FileCopyrightText: Copyright The Lima Authors # SPDX-License-Identifier: Apache-2.0 set -eu -o pipefail # Install required packages dnf install -y dnf-plugins-core dnf-plugin-versionlock llvm18-libs # Install Vulkan and Mesa base packages dnf install -y \ mesa-vulkan-drivers \ vulkan-loader-devel \ vulkan-headers \ vulkan-tools \ vulkan-loader \ glslc # Enable COPR repo with patched Mesa for Venus support dnf copr enable -y slp/mesa-libkrun-vulkan # Downgrade to patched Mesa version from COPR REPOID="copr:copr.fedorainfracloud.org:slp:mesa-libkrun-vulkan" MESA_VERSION=$(dnf repoquery -q --available --repoid="$REPOID" --latest-limit=1 --qf '%{evr}' mesa-vulkan-drivers 2>/dev/null) dnf downgrade -y "mesa-vulkan-drivers-${MESA_VERSION}" # Lock Mesa version to prevent automatic upgrades dnf versionlock add "mesa-vulkan-drivers-${MESA_VERSION}" # Clean up dnf clean all echo "Installing llama.cpp with Vulkan support..." # Build and install llama.cpp with Vulkan support dnf install -y git cmake clang curl-devel glslc vulkan-devel virglrenderer ( cd ~ git clone https://github.com/ggml-org/llama.cpp ( cd llama.cpp cmake -B build -DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DGGML_NATIVE=OFF -DCMAKE_INSTALL_PREFIX=/usr cmake --build build --config Release -j8 cmake --install build ) rm -fr llama.cpp ) echo "Successfully installed llama.cpp with Vulkan support. Use 'llama-cli' app with .gguf models." ``` -------------------------------- ### Start FreeBSD 15 Guest Source: https://lima-vm.io/docs/usage/guests/freebsd Command to initialize a FreeBSD 15 virtual machine using the built-in template. ```bash limactl start template:freebsd-15 ``` -------------------------------- ### Import a Disk Source: https://lima-vm.io/docs/reference/limactl_disk_import Example command to import a disk from a specified path. ```bash $ limactl disk import DISK DISKPATH ``` -------------------------------- ### Start macOS Guest Templates Source: https://lima-vm.io/docs/usage/guests/_print Commands to initialize macOS guest instances using standard or Homebrew-based templates. ```bash limactl start template:macos ``` ```bash limactl start template:homebrew-macos ``` -------------------------------- ### Start and run rootless Apptainer Source: https://lima-vm.io/docs/examples/containers/apptainer/_print Use the apptainer template to initialize a rootless instance and execute a container. ```bash limactl start template:apptainer limactl shell apptainer apptainer run -u -B $HOME:$HOME docker://alpine ``` -------------------------------- ### Start a Lima instance Source: https://lima-vm.io/docs/usage Initiates the creation and startup process for a Lima VM instance. ```bash $ limactl start ? Creating an instance "default" [Use arrows to move, type to filter] > Proceed with the current configuration Open an editor to review or modify the current configuration Choose another template (docker, podman, archlinux, fedora, ...) Exit ... INFO[0029] READY. Run `lima` to open the shell. ``` -------------------------------- ### Start FreeBSD 16 Guest Source: https://lima-vm.io/docs/usage/guests/freebsd Command to initialize a FreeBSD 16 (CURRENT) virtual machine using the experimental template. ```bash limactl start template:experimental/freebsd-16 ``` -------------------------------- ### Start and configure Docker Source: https://lima-vm.io/docs/examples/containers/docker Commands to initialize a Docker instance and set the DOCKER_HOST environment variable for container operations. ```bash limactl start template:docker export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock') docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine ``` ```bash limactl start template:docker-rootful export DOCKER_HOST=$(limactl list docker-rootful --format 'unix://{{.Dir}}/sock/docker.sock') docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine ``` -------------------------------- ### Start Lima instance with project mount Source: https://lima-vm.io/docs/config/ai/outside/gemini Initialize a Lima instance with the current directory mounted for access. ```bash limactl start --mount-only "$(pwd):w" default ``` -------------------------------- ### Start macOS Guest Template Source: https://lima-vm.io/docs/usage/guests/macos Initializes a macOS guest environment using the standard Lima template. ```bash limactl start template:macos ``` -------------------------------- ### Configure QEMU VM Type Source: https://lima-vm.io/docs/config/vmtype/_print Examples for setting the QEMU driver via CLI or YAML configuration. ```bash limactl start --vm-type=qemu ``` ```yaml vmType: "qemu" base: - template:_images/ubuntu - template:_default/mounts ``` -------------------------------- ### Install Lima to Home Directory Source: https://lima-vm.io/docs/installation/source Configure a custom installation prefix to avoid requiring sudo privileges. ```bash make PREFIX=$HOME/.local install export PATH=$HOME/.local/bin:$PATH ``` -------------------------------- ### Start VM with advanced configuration Source: https://lima-vm.io/docs/examples Launch a Fedora-based VM with specific resource allocations and virtualization features enabled. ```bash limactl start \ --name=default \ --cpus=4 \ --memory=8 \ --vm-type=vz \ --rosetta \ --mount-writable \ --network=vzNAT \ template:fedora ``` -------------------------------- ### Start and run rootful Apptainer Source: https://lima-vm.io/docs/examples/containers/apptainer/_print Use the apptainer-rootful template to initialize a rootful instance and execute a container. ```bash limactl start template:apptainer-rootful limactl shell apptainer-rootful apptainer run -u -B $HOME:$HOME docker://alpine ``` -------------------------------- ### Fast Mode Setup and Usage Source: https://lima-vm.io/docs/config/_print Enables QEMU User Mode Emulation for faster container execution across architectures. ```bash lima sudo systemctl start containerd lima sudo nerdctl run --privileged --rm tonistiigi/binfmt:qemu-v10.0.4-56@sha256:30cc9a4d03765acac9be2ed0afc23af1ad018aed2c28ea4be8c2eb9afe03fbd1 --install all ``` ```bash $ lima nerdctl run --platform=amd64 --rm alpine uname -m x86_64 $ lima nerdctl run --platform=arm64 --rm alpine uname -m aarch64 ``` ```bash $ lima nerdctl build --platform=amd64,arm64 -t example.com/foo:latest . $ lima nerdctl push --all-platforms example.com/foo:latest ``` -------------------------------- ### Start Windows Server 2025 VM Source: https://lima-vm.io/docs/usage/guests/windows Initializes a Windows Server 2025 guest instance using the specific template. ```bash limactl start template:windows-2025 ``` -------------------------------- ### Run model without containers Source: https://lima-vm.io/docs/config/vmtype/_print Start a Fedora-based krunkit VM and configure it for manual llama.cpp execution. ```bash limactl start --vm-type=krunkit template:fedora limactl shell fedora ``` ```yaml vmType: krunkit base: - template:_images/fedora - template:_default/mounts mountType: virtiofs ``` -------------------------------- ### Instance network configuration Source: https://lima-vm.io/docs/config/network/vmnet Example YAML configuration for referencing managed networks in an instance. ```yaml networks: # Lima can manage the socket_vmnet daemon for networks defined in $LIMA_HOME/_config/networks.yaml automatically. # The socket_vmnet binary must be installed into a secure location only alterable by the "root" user. # - lima: shared # # MAC address of the instance; lima will pick one based on the instance name, # # so DHCP assigned ip addresses should remain constant over instance restarts. # macAddress: "" # # Interface name, defaults to "lima0", "lima1", etc. # interface: "" ``` -------------------------------- ### Install Lima via Binary Archive Source: https://lima-vm.io/docs/installation/_print Download and extract the latest Lima binary release to /usr/local. ```bash VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name) curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local # For Lima v1.1 onward curl -fsSL "https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-additional-guestagents-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local ``` -------------------------------- ### Setup Multi-node Kubernetes Cluster Source: https://lima-vm.io/docs/examples/containers/kubernetes Commands to initialize a multi-node cluster using kubeadm and the lima:user-v2 network. ```bash limactl start --name k8s --network lima:user-v2 template:k8s limactl shell k8s sudo kubeadm token create --print-join-command # (The join command printed here) ``` ```bash limactl start --name k8s-1 --network lima:user-v2 template:k8s limactl shell k8s-1 sudo bash -euxc "kubeadm reset --force ; ip link delete cni0 ; ip link delete flannel.1 ; rm -rf /var/lib/cni /etc/cni" limactl shell k8s-1 sudo ``` ```bash limactl start --name k8s --network lima:user-v2 template:k8s limactl shell k8s sudo kubeadm token create --print-join-command # (The parameters for the start command printed here) ``` ```bash limactl start --name k8s-1 --network lima:user-v2 template:k8s \ --param url="https://" --param token="" \ --param discoveryTokenCaCertHash="" ``` -------------------------------- ### Create a Custom 'ps' Alias Source: https://lima-vm.io/docs/config/plugin/cli Steps to create, install, and execute a custom 'ps' alias for listing instances. ```bash #!/bin/sh # Show instances in a compact format limactl list --format table "$@" ``` ```bash chmod +x limactl-ps sudo mv limactl-ps /usr/local/bin/ ``` ```bash limactl ps # Shows instances in table format limactl ps --quiet # Shows only instance names ``` -------------------------------- ### Network creation and VM connection examples Source: https://lima-vm.io/docs/reference/limactl_network_create Demonstrates creating a network with a specific gateway and attaching multiple VM instances to it. ```bash Create a network: $ limactl network create foo --gateway 192.168.42.1/24 Connect VM instances to the newly created network: $ limactl create --network lima:foo --name vm1 $ limactl create --network lima:foo --name vm2 ``` -------------------------------- ### Install Rosetta 2 Source: https://lima-vm.io/docs/faq Command to install Rosetta on macOS if Lima gets stuck during installation. ```bash softwareupdate --install-rosetta ``` -------------------------------- ### Configure wsl2 mount Source: https://lima-vm.io/docs/config/mount Examples for enabling the experimental wsl2 mount type on Windows hosts. ```bash limactl start --vm-type=wsl2 --mount-type=wsl2 ``` ```yaml vmType: "wsl2" mountType: "wsl2" ``` -------------------------------- ### Build and install krunkit driver manually Source: https://lima-vm.io/docs/config/vmtype/krunkit Steps to build the driver from the Lima source repository if not pre-installed. ```bash git clone https://github.com/lima-vm/lima cd lima # Replace vX.Y.Z with the actual version git checkout vX.Y.Z make ADDITIONAL_DRIVERS=krunkit additional-drivers # Replace /usr/local with the actual installation prefix cp -a _output/libexec/lima/lima-driver-krunkit /usr/local/libexec/lima/ ``` -------------------------------- ### Start Lima with vz via CLI Source: https://lima-vm.io/docs/config/vmtype/vz Use the --vm-type flag to explicitly set the virtualization driver to vz. ```bash limactl start --vm-type=vz ``` -------------------------------- ### Run model using containers Source: https://lima-vm.io/docs/config/vmtype/_print Start a krunkit VM and execute the model inside a container with GPU access. ```bash limactl start --vm-type=krunkit limactl shell default ``` ```bash nerdctl run --rm -ti \ --device /dev/dri \ -v $(pwd)/models:/models \ quay.io/slopezpa/fedora-vgpu-llama ``` ```bash llama-cli -m /models/Qwen3-1.7B-Q8_0.gguf -b 512 -ngl 99 -p "Introduce yourself" ``` -------------------------------- ### Open interactive shell with sync Source: https://lima-vm.io/docs/examples/_print Start an interactive shell session in the guest VM with the current directory synchronized. ```bash limactl shell --sync . default ``` -------------------------------- ### Execute custom URL handlers Source: https://lima-vm.io/docs/config/plugin/url Commands to start instances using the defined custom URL schemes. ```bash $ limactl start dev:webapp # uses master branch $ limactl start prod:webapp # uses pinned release ``` -------------------------------- ### Configure VZ VM Type Source: https://lima-vm.io/docs/config/vmtype/_print Examples for setting the VZ driver via CLI or YAML configuration. ```bash limactl start --vm-type=vz ``` ```yaml vmType: "vz" base: - template:_images/ubuntu - template:_default/mounts ``` -------------------------------- ### Configure 9p mount Source: https://lima-vm.io/docs/config/mount Examples for enabling the 9p mount type via CLI or YAML configuration. ```bash limactl start --vm-type=qemu --mount-type=9p ``` ```yaml vmType: "qemu" mountType: "9p" mounts: - location: "~" 9p: # Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none". # "mapped-xattr" and "mapped-file" are useful for persistent chown but incompatible with symlinks. # 🟢 Builtin default: "none" (since Lima v0.13) securityModel: null # Select 9P protocol version. Valid options are: "9p2000" (legacy), "9p2000.u", "9p2000.L". # 🟢 Builtin default: "9p2000.L" protocolVersion: null # The number of bytes to use for 9p packet payload, where 4KiB is the absolute minimum. # 🟢 Builtin default: "128KiB" msize: null # Specifies a caching policy. Valid options are: "none", "loose", "fscache" and "mmap". # Try choosing "mmap" or "none" if you see a stability issue with the default "fscache". # See https://www.kernel.org/doc/Documentation/filesystems/9p.txt # 🟢 Builtin default: "fscache" for non-writable mounts, "mmap" for writable mounts cache: null ``` -------------------------------- ### Start Lima with WSL2 via CLI Source: https://lima-vm.io/docs/config/vmtype/wsl2 Command to initialize a Lima instance using the wsl2 vmType and mount type. ```bash limactl start --vm-type=wsl2 --mount-type=wsl2 --containerd=system ``` -------------------------------- ### Start Lima VM with QEMU via CLI Source: https://lima-vm.io/docs/config/vmtype/qemu Use the command line interface to initialize a VM using the QEMU driver. ```bash limactl start --vm-type=qemu ``` -------------------------------- ### Install Lima via MacPorts Source: https://lima-vm.io/docs/installation/_print Use MacPorts to install Lima on macOS. ```bash sudo port install lima ``` -------------------------------- ### Install bypass4netnsd Source: https://lima-vm.io/docs/examples/containers/containerd/advanced/bypass4netns Installs the bypass4netns daemon process within the Lima VM. ```bash lima containerd-rootless-setuptool.sh install-bypass4netnsd ``` -------------------------------- ### Start Slow Mode VM via CLI Source: https://lima-vm.io/docs/config/multi-arch Initializes a VM with a foreign architecture using QEMU system emulation. ```bash limactl start --vm-type=qemu --arch=x86_64 --plain ``` -------------------------------- ### View Plugin Info JSON Source: https://lima-vm.io/docs/config/plugin/cli Example JSON output from 'limactl info' displaying plugin paths. ```json { "plugins": [ { "name": "ps", "path": "/opt/homebrew/bin/limactl-ps" }, { "name": "sh", "path": "/opt/homebrew/bin/limactl-sh" } ] } ``` -------------------------------- ### Install Lima via Nix Source: https://lima-vm.io/docs/installation/_print Use the Nix package manager to install Lima. ```bash nix-env -i lima ``` -------------------------------- ### Install Lima via Homebrew Source: https://lima-vm.io/docs/installation/_print Use Homebrew to install Lima on macOS or Linux. ```bash brew install lima ``` -------------------------------- ### Command options for autostart enable Source: https://lima-vm.io/docs/reference/limactl_autostart_enable Configuration flags for defining the startup condition and user context. ```bash --condition string When to start the instance: "login" (user session) or "boot" (system boot, macOS only) (default "login") -h, --help help for enable --user string macOS username to run the instance as when --condition=boot (default: $USER) ``` -------------------------------- ### Start Rootless Docker Source: https://lima-vm.io/docs/examples/containers/docker/_print Initializes a rootless Docker instance and sets the DOCKER_HOST environment variable to point to the Lima socket. ```bash limactl start template:docker export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock') docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine ``` -------------------------------- ### Setup Multi-node K3s Cluster Source: https://lima-vm.io/docs/examples/containers/kubernetes Commands to initialize a multi-node K3s cluster using the lima:user-v2 network. ```bash limactl start --name k3s --network lima:user-v2 template:k3s printf "https://lima-%s.internal:6443\n" k3s # (The url for the start command printed here) limactl shell k3s sudo cat /var/lib/rancher/k3s/server/node-token # (The token for the start command printed here) ``` ```bash limactl start --name k3s-1 --network lima:user-v2 template:k3s \ --param url="" --param token="" ``` -------------------------------- ### Verify limactl mcp installation Source: https://lima-vm.io/docs/config/ai/outside/gemini Check the installed version of the limactl mcp plugin. ```bash $ limactl mcp -v limactl-mcp version 2.0.0-alpha.1 ``` -------------------------------- ### Initialize Single-node Kubernetes Clusters Source: https://lima-vm.io/docs/examples/containers/kubernetes Commands to start a single-node cluster and configure the KUBECONFIG environment variable for various distributions. ```bash limactl start template:k8s export KUBECONFIG=$(limactl list k8s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') kubectl create deployment nginx --image nginx:alpine kubectl create service nodeport nginx --node-port=31080 --tcp=80:80 ``` ```bash limactl start template:k3s export KUBECONFIG=$(limactl list k3s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') kubectl create deployment nginx --image nginx:alpine kubectl create service nodeport nginx --node-port=31080 --tcp=80:80 ``` ```bash limactl start template:k0s export KUBECONFIG=$(limactl list k0s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') kubectl create deployment nginx --image nginx:alpine kubectl create service nodeport nginx --node-port=31080 --tcp=80:80 ``` ```bash limactl start template:experimental/rke2 export KUBECONFIG=$(limactl list rke2 --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') kubectl create deployment nginx --image nginx:alpine kubectl create service nodeport nginx --node-port=31080 --tcp=80:80 ``` ```bash limactl start template:experimental/u7s export KUBECONFIG=$(limactl list u7s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml') kubectl create deployment nginx --image nginx:alpine # NodePorts are not available by default in the case of Usernetes kubectl port-forward deployments/nginx 8080:80 ``` -------------------------------- ### Run rootless Podman containers Source: https://lima-vm.io/docs/examples/containers/podman Commands to start a rootless Podman instance and run an Nginx container from within the VM. ```bash limactl start template:podman limactl shell podman podman run -d --name nginx -p 127.0.0.1:8080:80 docker.io/library/nginx:alpine ``` -------------------------------- ### Connect to VM via SOCKS proxy Source: https://lima-vm.io/docs/config/_print Examples for accessing the VM network using curl or environment variables. ```bash curl --proxy socks5h://127.0.0.1: http://lima-default.internal ``` ```bash export ALL_PROXY=socks5h://127.0.0.1: curl http://lima-default.internal ``` -------------------------------- ### Delete a snapshot example Source: https://lima-vm.io/docs/reference/limactl_snapshot_delete An example of deleting a snapshot named 'snap1' from the 'default' instance. ```bash Delete a snapshot: $ limactl snapshot delete default --tag snap1 ``` -------------------------------- ### Download Qwen3-1.7B model Source: https://lima-vm.io/docs/config/vmtype/krunkit Prepare a local directory and download the GGUF model for testing. ```bash mkdir -p models curl -LO --output-dir models 'https://huggingface.co/Qwen/Qwen3-1.7B-GGUF/resolve/main/Qwen3-1.7B-Q8_0.gguf' ``` -------------------------------- ### Install and run Claude Code Source: https://lima-vm.io/docs/examples/ai Installs Claude Code using npm and configures the API key. ```bash lima sudo snap install node --classic lima sudo npm install -g @anthropic-ai/claude-code lima claude ``` ```bash lima vi "/home/${USER}.linux/.bash_profile" ``` -------------------------------- ### limactl start Source: https://lima-vm.io/docs/reference/limactl_start Starts a Lima instance. If the instance does not exist, it is created based on the provided template, file, or URL. ```APIDOC ## limactl start ### Description Starts a Lima virtual machine instance. If the instance name is not already created, it will be created using the specified template, YAML file, or URL. ### Usage `limactl start [NAME|FILE.yaml|URL] [flags]` ### Parameters #### Positional Arguments - **NAME|FILE.yaml|URL** (string) - Optional - The name of the instance, a path to a configuration file, or a URL to a template. #### Flags - **--arch** (string) - Optional - Machine architecture (x86_64, aarch64, riscv64, armv7l, s390x, ppc64le). - **--cpus** (int) - Optional - Number of CPUs. - **--memory** (float32) - Optional - Memory in GiB. - **--disk** (float32) - Optional - Disk size in GiB. - **--foreground** (bool) - Optional - Run the hostagent in the foreground. - **--timeout** (duration) - Optional - Duration to wait for the instance to be running (default 10m0s). - **--name** (string) - Optional - Override the instance name. - **--debug** (bool) - Optional - Enable debug mode. - **--tty** (bool) - Optional - Enable TUI interactions. ### Examples - Start/Create default instance: `limactl start` - Start/Create instance from template: `limactl start --name=default template:docker` ``` -------------------------------- ### Ping output example Source: https://lima-vm.io/docs/faq Example of ping behavior showing duplicate packets and high latency due to SLIRP networking. ```text $ ping google.com PING google.com (172.217.165.14): 56 data bytes 64 bytes from 172.217.165.14: seq=0 ttl=42 time=2395159.646 ms 64 bytes from 172.217.165.14: seq=0 ttl=42 time=2396160.798 ms (DUP!) ``` -------------------------------- ### Run llama-cli manually Source: https://lima-vm.io/docs/config/vmtype/krunkit Execute the model after manual installation of dependencies. ```bash llama-cli -m models/Qwen3-1.7B-Q8_0.gguf -b 512 -ngl 99 -p "Introduce yourself" ``` -------------------------------- ### Disable containerd Source: https://lima-vm.io/docs/examples/containers/containerd/_print Command to start a Lima instance without containerd. ```bash limactl start --containerd=none ``` -------------------------------- ### limactl watch examples Source: https://lima-vm.io/docs/reference/limactl_watch Common usage patterns for monitoring instance events. ```bash # Watch events from all instances: $ limactl watch # Watch events from a specific instance: $ limactl watch default # Include historical events: $ limactl watch --history default # Show verbose output (host agent logs, etc.): $ limactl watch --verbose # Watch events in JSON format (for scripting): $ limactl watch --json default ``` -------------------------------- ### Configure sudoers for network daemon Source: https://lima-vm.io/docs/config/network/vmnet Commands to generate and install the sudoers file for socket_vmnet. ```bash limactl sudoers >etc_sudoers.d_lima less etc_sudoers.d_lima # verify that the file looks correct sudo install -o root etc_sudoers.d_lima /etc/sudoers.d/lima rm etc_sudoers.d_lima ``` -------------------------------- ### Compare Container Start-up with eStargz Source: https://lima-vm.io/docs/examples/containers/containerd/advanced/_print Compare standard container start-up times with eStargz lazy-pulling performance. ```bash $ time lima nerdctl run ghcr.io/stargz-containers/python:3.13-org python3 -c 'print("hi")' hi real 0m14.031s user 0m0.017s sys 0m0.018s ``` ```bash $ time lima nerdctl --snapshotter=stargz run ghcr.io/stargz-containers/python:3.13-esgz python3 -c 'print("hi")' hi real 0m3.275s user 0m0.017s sys 0m0.016s ``` -------------------------------- ### Setup Fast Mode with QEMU User Emulation Source: https://lima-vm.io/docs/config/multi-arch Configures containerd to use QEMU user-mode emulation for faster cross-architecture container execution. ```bash lima sudo systemctl start containerd lima sudo nerdctl run --privileged --rm tonistiigi/binfmt:qemu-v10.0.4-56@sha256:30cc9a4d03765acac9be2ed0afc23af1ad018aed2c28ea4be8c2eb9afe03fbd1 --install all ``` -------------------------------- ### Unlock disk examples Source: https://lima-vm.io/docs/reference/limactl_disk_unlock Commands to unlock a single disk or multiple disks simultaneously. ```bash $ limactl disk unlock DISK ``` ```bash $ limactl disk unlock DISK1 DISK2 ... ``` -------------------------------- ### limactl autostart command options Source: https://lima-vm.io/docs/reference/limactl_autostart Displays the specific help options available for the autostart command. ```bash -h, --help help for autostart ``` -------------------------------- ### Start Lima VM with project directory mount Source: https://lima-vm.io/docs/examples/ai Mounts the current directory into the VM. Use the v2.0+ syntax for simple mounting or the v1.x syntax for explicit configuration. ```bash limactl start --mount-only .:w ``` ```bash limactl start --set ".mounts=[{\"location\":\"$(pwd)\", \"writable\":true}]" ``` -------------------------------- ### Start Lima with vzNAT Source: https://lima-vm.io/docs/examples/containers/containerd/advanced/bypass4netns Recommended configuration for macOS hosts to reduce user-mode networking overhead. ```bash limactl start --network vzNAT ``` -------------------------------- ### Configure VM settings with Lima and Colima Source: https://lima-vm.io/docs/faq/colima Comparison of CLI flags for configuring CPU, mounting, and networking options. ```bash limactl start --cpus=4 ``` ```bash colima start --cpu=4 ``` ```bash limactl start --mount-type=reverse-sshfs ``` ```bash colima start --mount-type=sshfs ``` ```bash limactl start --rosetta ``` ```bash colima start --vz-rosetta ``` ```bash limactl start --network=lima:shared ``` ```bash colima start --network-address ```