Skip to content

Commit fbda18d

Browse files
authored
Merge pull request #1836 from AkihiroSuda/docs
docs/config: add more tabpanes
2 parents b4c1c34 + c01d1d4 commit fbda18d

File tree

7 files changed

+161
-70
lines changed

7 files changed

+161
-70
lines changed

website/content/en/docs/Config/Mount/_index.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ While the host works as an SFTP server, the host does not open any TCP port,
2222
as the host initiates an SSH connection into the guest and let the guest connect to the SFTP server via the stdin.
2323

2424
An example configuration:
25+
{{< tabpane text=true >}}
26+
{{% tab header="CLI" %}}
27+
```bash
28+
limactl start --mount-type=reverse-sshfs
29+
```
30+
{{% /tab %}}
31+
{{% tab header="YAML" %}}
2532
```yaml
2633
mountType: "reverse-sshfs"
2734
mounts:
@@ -43,6 +50,8 @@ mounts:
4350
# 🟢 Builtin default: "openssh-sftp-server" if OpenSSH SFTP Server binary is found, otherwise "builtin"
4451
sftpDriver: null
4552
```
53+
{{% /tab %}}
54+
{{< /tabpane >}}
4655
4756
The default value of `sftpDriver` has been set to "openssh-sftp-server" since Lima v0.10, when an OpenSSH SFTP Server binary
4857
such as `/usr/libexec/sftp-server` is detected on the host.
@@ -60,7 +69,15 @@ The "9p" mount type is implemented by using QEMU's virtio-9p-pci devices.
6069
virtio-9p-pci is also known as "virtfs", but note that this is unrelated to [virtio-fs](https://virtio-fs.gitlab.io/).
6170

6271
An example configuration:
72+
{{< tabpane text=true >}}
73+
{{% tab header="CLI" %}}
74+
```bash
75+
limactl start --vm-type=qemu --mount-type=9p
76+
```
77+
{{% /tab %}}
78+
{{% tab header="YAML" %}}
6379
```yaml
80+
vmType: "qemu"
6481
mountType: "9p"
6582
mounts:
6683
- location: "~"
@@ -81,6 +98,8 @@ mounts:
8198
# 🟢 Builtin default: "fscache" for non-writable mounts, "mmap" for writable mounts
8299
cache: null
83100
```
101+
{{% /tab %}}
102+
{{< /tabpane >}}
84103

85104
The "9p" mount type requires Lima v0.10.0 or later.
86105

@@ -98,12 +117,21 @@ The "virtiofs" mount type is implemented via the virtio-fs device by using apple
98117
Linux guest kernel must enable the CONFIG_VIRTIO_FS support for this support.
99118

100119
An example configuration:
120+
{{< tabpane text=true >}}
121+
{{% tab header="CLI" %}}
122+
```bash
123+
limactl start --vm-type=vz --mount-type=virtiofs
124+
```
125+
{{% /tab %}}
126+
{{% tab header="YAML" %}}
101127
```yaml
102128
vmType: "vz" # only for macOS; Linux uses 'qemu'
103129
mountType: "virtiofs"
104130
mounts:
105131
- location: "~"
106132
```
133+
{{% /tab %}}
134+
{{< /tabpane >}}
107135

108136
#### Caveats
109137
- For macOS, the "virtiofs" mount type is supported only on macOS 13 or above with `vmType: vz` config. See also [`vmtype.md`](./vmtype.md).
@@ -120,10 +148,19 @@ mounts:
120148
The "wsl2" mount type relies on using WSL2's navite disk sharing, where the root disk is available by default at `/mnt/$DISK_LETTER` (e.g. `/mnt/c/`).
121149

122150
An example configuration:
151+
{{< tabpane text=true >}}
152+
{{% tab header="CLI" %}}
153+
```bash
154+
limactl start --vm-type=wsl2 --mount-type=wsl2
155+
```
156+
{{% /tab %}}
157+
{{% tab header="YAML" %}}
123158
```yaml
124159
vmType: "wsl2"
125160
mountType: "wsl2"
126161
```
162+
{{% /tab %}}
163+
{{< /tabpane >}}
127164

128165
#### Caveats
129166
- WSL2 file permissions may not work exactly as expected when accessing files that are natively on the Windows disk ([more info](https://github.com/MicrosoftDocs/WSL/blob/mattw-wsl2-explainer/WSL/file-permissions.md))

website/content/en/docs/Config/Multi-arch/_index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ See also https://github.com/containerd/nerdctl/blob/master/docs/multi-platform.m
7171
[Rosetta](https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta) is known to be much faster than QEMU User Mode Emulation.
7272
Rosetta is available for [VZ](./vmtype.md) instances on ARM hosts.
7373

74+
{{< tabpane text=true >}}
75+
{{% tab header="CLI" %}}
76+
```bash
77+
limactl start --vm-type=vz --rosetta
78+
```
79+
{{% /tab %}}
80+
{{% tab header="YAML" %}}
7481
```yaml
7582
vmType: "vz"
7683
rosetta:
@@ -80,3 +87,5 @@ rosetta:
8087
# Register rosetta to /proc/sys/fs/binfmt_misc
8188
binfmt: true
8289
```
90+
{{% /tab %}}
91+
{{< /tabpane >}}

website/content/en/docs/Config/Network/_index.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@ title: Network
33
weight: 30
44
---
55

6-
## user-mode network (192.168.5.0/24)
6+
See the following flowchart to choose the best network for you:
7+
```mermaid
8+
flowchart
9+
connect_to_vm_via{"Connect to the VM via"} -- "localhost" --> default["Default"]
10+
connect_to_vm_via -- "IP" --> connect_from{"Connect to the VM IP from"}
11+
connect_from -- "Host" --> vm{"VM type"}
12+
vm -- "vz" --> vzNAT["vzNAT"]
13+
vm -- "qemu" --> shared["socket_vmnet (shared)"]
14+
connect_from -- "Other VMs" --> userV2["user-v2"]
15+
connect_from -- "Other hosts" --> bridged["socket_vmnet (bridged)"]
16+
```
17+
18+
## Default user-mode network (192.168.5.0/24)
719

820
By default Lima only enables the user-mode networking aka "slirp".
921

@@ -125,8 +137,15 @@ networks:
125137
126138
</details>
127139
128-
Instances can then reference these networks from their `lima.yaml` file:
140+
Instances can then reference these networks:
129141
142+
{{< tabpane text=true >}}
143+
{{% tab header="CLI" %}}
144+
```bash
145+
limactl start --network=lima:shared
146+
```
147+
{{% /tab %}}
148+
{{% tab header="YAML" %}}
130149
```yaml
131150
networks:
132151
# Lima can manage the socket_vmnet daemon for networks defined in $LIMA_HOME/_config/networks.yaml automatically.
@@ -139,6 +158,8 @@ networks:
139158
# # Interface name, defaults to "lima0", "lima1", etc.
140159
# interface: ""
141160
```
161+
{{% /tab %}}
162+
{{< /tabpane >}}
142163

143164
The network daemon is started automatically when the first instance referencing them is started,
144165
and will stop automatically once the last instance has stopped. Daemon logs will be stored in the
@@ -170,10 +191,19 @@ networks:
170191
|-------------------|-----------------------------|
171192

172193
For [VZ](./vmtype.md) instances, the "vzNAT" network can be configured as follows:
194+
{{< tabpane text=true >}}
195+
{{% tab header="CLI" %}}
196+
```bash
197+
limactl start --vm-type=vz --network=vzNAT
198+
```
199+
{{% /tab %}}
200+
{{% tab header="YAML" %}}
173201
```yaml
174202
networks:
175203
- vzNAT: true
176204
```
205+
{{% /tab %}}
206+
{{< /tabpane >}}
177207
178208
The range of the IP address is not specifiable.
179209
@@ -201,10 +231,19 @@ networks:
201231

202232
Instances can then reference these networks from their `lima.yaml` file:
203233

234+
{{< tabpane text=true >}}
235+
{{% tab header="CLI" %}}
236+
```bash
237+
limactl start --network=lima:example-user-v2
238+
```
239+
{{% /tab %}}
240+
{{% tab header="YAML" %}}
204241
```yaml
205242
networks:
206243
- lima: example-user-v2
207244
```
245+
{{% /tab %}}
246+
{{< /tabpane >}}
208247

209248
_Note_
210249

website/content/en/docs/Config/VMType/_index.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ This option is used by default if "vmType" is not set.
3636
"vz" option makes use of native virtualization support provided by macOS Virtualization.Framework.
3737

3838
An example configuration:
39+
{{< tabpane text=true >}}
40+
{{% tab header="CLI" %}}
41+
```bash
42+
limactl start --vm-type=vz --mount-type=virtiofs
43+
```
44+
{{% /tab %}}
45+
{{% tab header="YAML" %}}
3946
```yaml
4047
# Example to run ubuntu using vmType: vz instead of qemu (Default)
4148
vmType: "vz"
@@ -48,7 +55,8 @@ mounts:
4855
- location: "~"
4956
mountType: "virtiofs"
5057
```
51-
58+
{{% /tab %}}
59+
{{< /tabpane >}}
5260
### Caveats
5361
- "vz" option is only supported on macOS 13 or above
5462
- Virtualization.framework doesn't support running "intel guest on arm" and vice versa
@@ -71,6 +79,13 @@ mountType: "virtiofs"
7179
"wsl2" option makes use of native virtualization support provided by Windows' `wsl.exe` ([more info](https://learn.microsoft.com/en-us/windows/wsl/about)).
7280

7381
An example configuration:
82+
{{< tabpane text=true >}}
83+
{{% tab header="CLI" %}}
84+
```bash
85+
limactl start --vm-type=wsl2 --mount-type=wsl2 --containerd=system
86+
```
87+
{{% /tab %}}
88+
{{% tab header="YAML" %}}
7489
```yaml
7590
# Example to run Fedora using vmType: wsl2
7691
vmType: wsl2
@@ -84,6 +99,8 @@ containerd:
8499
system: true
85100
user: false
86101
```
102+
{{% /tab %}}
103+
{{< /tabpane >}}
87104

88105
### Caveats
89106
- "wsl2" option is only supported on newer versions of Windows (roughly anything since 2019)

website/content/en/docs/Config/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ weight: 5
44
---
55

66
For all the configuration items, see <https://github.com/lima-vm/lima/blob/master/examples/default.yaml>.
7+
8+
The current default spec:
9+
- OS: Ubuntu
10+
- CPU: 4 cores
11+
- Memory: 4 GiB
12+
- Disk: 100 GiB
13+
- Mounts: `~` (read-only), `/tmp/lima` (writable)
14+
- SSH: 127.0.0.1:60022

website/content/en/docs/Usage/_index.md

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ title: Usage
33
weight: 2
44
---
55

6-
## Start a linux instance
6+
## Starting a Linux instance
77

8-
```console
9-
limactl start [--name=NAME] [--tty=false] <template://TEMPLATE>
10-
```
8+
Run `limactl start <INSTANCE>` to create and start the first instance.
9+
The `<INSTANCE>` name defaults to "default".
1110

1211
```console
1312
$ limactl start
@@ -24,38 +23,34 @@ Choose `Proceed with the current configuration`, and wait until "READY" to be pr
2423

2524
For automation, `--tty=false` flag can be used for disabling the interactive user interface.
2625

27-
### Advanced usage
26+
### Customization
2827
To create an instance "default" from a template "docker":
29-
```console
30-
$ limactl start --name=default template://docker
28+
```bash
29+
limactl create --name=default template://docker
30+
limactl start default
3131
```
3232

33-
To create an instance "default" with modified parameters:
34-
```console
35-
$ limactl start --set='.cpus = 2 | .memory = "2GiB"'
36-
```
33+
See also the command reference:
34+
- [`limactl create`](../reference/limactl_create/)
35+
- [`limactl start`](../reference/limactl_start/)
36+
- [`limactl edit`](../reference/limactl_edit/)
3737

38-
To see the template list:
39-
```console
40-
$ limactl start --list-templates
38+
### Executing Linux commands
39+
Run `limactl shell <INSTANCE> <COMMAND>` to launch `<COMMAND>` on the VM:
40+
```bash
41+
limactl shell default uname -a
4142
```
4243

43-
To create an instance "default" from a local file:
44-
```console
45-
$ limactl start --name=default /usr/local/share/lima/templates/fedora.yaml
46-
```
47-
48-
To create an instance "default" from a remote URL (use carefully, with a trustable source):
49-
```console
50-
$ limactl start --name=default https://raw.githubusercontent.com/lima-vm/lima/master/examples/alpine.yaml
51-
```
52-
53-
#### limactl shell
54-
`limactl shell <INSTANCE> <COMMAND>`: launch `<COMMAND>` on Linux.
44+
See also the command reference:
45+
- [`limactl shell`](../reference/limactl_shell/)
5546

5647
For the "default" instance, this command can be shortened as `lima <COMMAND>`.
48+
```bash
49+
lima uname -a
50+
```
5751
The `lima` command also accepts the instance name as the environment variable `$LIMA_INSTANCE`.
5852

53+
5954
SSH can be used too:
6055
```console
6156
$ limactl ls --format='{{.SSHConfigFile}}' default
@@ -64,28 +59,6 @@ $ limactl ls --format='{{.SSHConfigFile}}' default
6459
$ ssh -F /Users/example/.lima/default/ssh.config lima-default
6560
```
6661

67-
#### limactl completion
62+
### Shell completion
6863
- To enable bash completion, add `source <(limactl completion bash)` to `~/.bash_profile`.
69-
7064
- To enable zsh completion, see `limactl completion zsh --help`
71-
72-
## Configuration
73-
{{% fixlinks %}}
74-
75-
See [`./examples/default.yaml`](./examples/default.yaml).
76-
77-
The current default spec:
78-
- OS: Ubuntu 23.04 (Lunar Lobster)
79-
- CPU: 4 cores
80-
- Memory: 4 GiB
81-
- Disk: 100 GiB
82-
- Mounts: `~` (read-only), `/tmp/lima` (writable)
83-
- SSH: 127.0.0.1:60022
84-
85-
## How it works
86-
87-
- Hypervisor: [QEMU with HVF accelerator (default), or Virtualization.framework](./docs/vmtype.md)
88-
- Filesystem sharing: [Reverse SSHFS (default), or virtio-9p-pci aka virtfs, or virtiofs](./docs/mount.md)
89-
- Port forwarding: `ssh -L`, automated by watching `/proc/net/tcp` and `iptables` events in the guest
90-
91-
{{% /fixlinks %}}

0 commit comments

Comments
 (0)