create
limactl create
创建 Lima 实例
limactl create FILE.yaml|URL [flags]
示例
To create an instance "default" from the default Ubuntu template:
$ limactl create
To create an instance "default" from a template "docker":
$ limactl create --name=default template://docker
To create an instance "default" with modified parameters:
$ limactl create --cpus=2 --memory=2
To create an instance "default" with yq expressions:
$ limactl create --set='.cpus = 2 | .memory = "2GiB"'
To see the template list:
$ limactl create --list-templates
To create an instance "default" from a local file:
$ limactl create --name=default /usr/local/share/lima/templates/fedora.yaml
To create an instance "default" from a remote URL (use carefully, with a trustable source):
$ limactl create --name=default https://raw.githubusercontent.com/lima-vm/lima/master/templates/alpine.yaml
To create an instance "local" from a template passed to stdin (--name parameter is required):
$ cat template.yaml | limactl create --name=local -
选项
--arch string 机器架构 (x86_64, aarch64, riscv64, armv7l, s390x, ppc64le)
--containerd string containerd 模式 (user, system, user+system, none)
--cpus int CPU 数量
--disk float32 磁盘大小(GiB)
--dns ipSlice 指定自定义 DNS(禁用主机解析器) (default [])
-h, --help help for create
--list-drivers 列出可用驱动并退出
--list-templates 列出可用模板并退出
--memory float32 内存大小(GiB)
--mount strings 要挂载的目录,后缀 ':w' 表示可写(不要指定与现有挂载重叠的目录)
--mount-inotify 为挂载启用 inotify
--mount-none 移除所有挂载
--mount-only strings 类似于 --mount,但会覆盖现有挂载
--mount-type string 挂载类型 (reverse-sshfs, 9p, virtiofs)
--mount-writable 使所有挂载可写
--name string 覆盖实例名称
--network strings 附加网络,例如 "vzNAT" 或 "lima:shared" 来分配 vmnet IP
--plain Plain 模式。禁用挂载、端口转发、containerd 等。
--port-forward stringArray 端口转发 (主机:客户机),例如,'8080:80' 或 '9090:9090,static=true' 表示静态端口转发
--rosetta 启用 Rosetta(用于 vz 实例)
--set string 使用 yq 语法就地修改模板
--ssh-port uint16 SSH 端口 (0 为随机)
--video 启用视频输出(对 QEMU 有负面性能影响)
--vm-type string 虚拟机类型
从父命令继承的选项
--debug 调试模式
--log-format string 设置日志格式 [text, json] (default "text")
--log-level string 设置日志级别 [trace, debug, info, warn, error]
--tty 启用 TUI 交互,如打开编辑器。默认在终端时为 true。自动化时设为 false。
-y, --yes --tty=false 的别名
另请参见
- limactl - Lima: Linux 虚拟机