Skip to content

Commit beabc0b

Browse files
committed
Add environment variables documentation
Created a new PR to avoid the blockage of lima-vm#2455 Add documentation for environment variables used in Lima. * **New Documentation Page**: Add `website/content/en/docs/config/environment-variables.md` to document environment variables `LIMA_INSTANCE`, `LIMA_SHELL`, `LIMA_WORKDIR`, `LIMACTL`, and `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`. * **Update Configuration Guide**: Modify `website/content/en/docs/config/_index.md` to include a link to the new 'Environment Variables' page. * **Update README**: Modify `README.md` to include a link to the new 'Environment Variables' page. * **Add Comments in Scripts**: - `cmd/lima`: Add comments documenting `LIMA_INSTANCE`, `LIMA_SHELL`, `LIMA_WORKDIR`, and `LIMACTL`. - `cmd/lima.bat`: Add comments documenting `LIMA_INSTANCE` and `LIMACTL`. - `cmd/docker.lima`: Add comments documenting `LIMA_INSTANCE`. - `cmd/kubectl.lima`: Add comments documenting `LIMA_INSTANCE`. - `cmd/limactl/usernet.go`: Add comments documenting `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/lima-vm/lima/pull/2455?shareId=XXXX-XXXX-XXXX-XXXX). Signed-off-by: மனோஜ்குமார் பழனிச்சாமி <[email protected]>
1 parent 495db7a commit beabc0b

File tree

8 files changed

+95
-6
lines changed

8 files changed

+95
-6
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ GUI:
7474
### Code of Conduct
7575
Lima follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
7676

77+
### Environment Variables
78+
For more information on environment variables, see the [Environment Variables](https://lima-vm.io/docs/config/environment-variables/) page.
79+
7780
- - -
7881
**We are a [Cloud Native Computing Foundation](https://cncf.io/) sandbox project.**
7982

@@ -82,4 +85,4 @@ Lima follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/
8285
<img src="https://www.cncf.io/wp-content/uploads/2022/07/cncf-color-bg.svg" width=300 />
8386
</picture>
8487

85-
The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/trademark-usage/).
88+
The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see [Trademark Usage](https://www.linuxfoundation.org/trademark-usage/].

cmd/docker.lima

100755100644
+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/sh
22
set -eu
3+
4+
# Environment Variables
5+
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "docker".
6+
37
: "${LIMA_INSTANCE:=docker}"
48
: "${DOCKER:=docker}"
59

610
if [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
711
echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl create --name=$LIMA_INSTANCE template://docker\` to create a new instance" >&2
812
exit 1
913
elif [ "$(limactl ls -f '{{ .Status }}' "$LIMA_INSTANCE" 2>/dev/null)" != "Running" ]; then
10-
echo "instance \"$LIMA_INSTANCE\" is not running, run \`limactl start $LIMA_INSTANCE\` to start the existing instance" >&2
14+
echo "instance \"$LIMA_INSTANCE\"" is not running, run \`limactl start $LIMA_INSTANCE\` to start the existing instance" >&2
1115
exit 1
1216
fi
1317
DOCKER=$(command -v "$DOCKER" || true)

cmd/kubectl.lima

100755100644
+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/sh
22
set -eu
3+
4+
# Environment Variables
5+
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is empty.
6+
37
: "${LIMA_INSTANCE:=}"
48
: "${KUBECTL:=kubectl}"
59

cmd/lima

100755100644
+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/sh
22
set -eu
3+
4+
# Environment Variables
5+
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default".
6+
# LIMA_SHELL: Specifies the shell interpreter to use inside the Lima instance. Default is the user's shell configured inside the instance.
7+
# LIMA_WORKDIR: Specifies the initial working directory inside the Lima instance. Default is the current directory from the host.
8+
# LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in $PATH.
9+
310
: "${LIMA_INSTANCE:=default}"
411
: "${LIMA_SHELL:=}"
512
: "${LIMA_WORKDIR:=}"

cmd/lima.bat

100755100644
+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
@echo off
2-
IF NOT DEFINED LIMACTL (SET LIMACTL=limactl)
3-
IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default)
4-
%LIMACTL% shell %LIMA_INSTANCE% %*
1+
@echo off
2+
REM Environment Variables
3+
REM LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default".
4+
REM LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in %PATH%.
5+
6+
IF NOT DEFINED LIMACTL (SET LIMACTL=limactl)
7+
IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default)
8+
%LIMACTL% shell %LIMA_INSTANCE% %*

cmd/limactl/usernet.go

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ func usernetAction(cmd *cobra.Command, _ []string) error {
7373
os.RemoveAll(qemuSocket)
7474
os.RemoveAll(fdSocket)
7575

76+
// Environment Variables
77+
// LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT: Specifies the timeout duration for resolving IP addresses in minutes. Default is 2 minutes.
78+
7679
return usernet.StartGVisorNetstack(cmd.Context(), &usernet.GVisorNetstackOpts{
7780
MTU: mtu,
7881
Endpoint: endpoint,

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

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ The current default spec:
1212
- Disk: 100 GiB
1313
- Mounts: `~` (read-only), `/tmp/lima` (writable)
1414
- SSH: 127.0.0.1:60022
15+
16+
For environment variables, see [Environment Variables](./environment-variables/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Environment Variables
3+
weight: 6
4+
---
5+
6+
## Environment Variables
7+
8+
This page documents the environment variables used in Lima.
9+
10+
### `LIMA_INSTANCE`
11+
12+
- **Description**: Specifies the name of the Lima instance to use.
13+
- **Default**: `default`
14+
- **Usage**:
15+
```sh
16+
export LIMA_INSTANCE=my-instance
17+
lima uname -a
18+
```
19+
- **Used in**: `cmd/lima`, `cmd/lima.bat`, `cmd/docker.lima`, `cmd/kubectl.lima`
20+
21+
### `LIMA_SHELL`
22+
23+
- **Description**: Specifies the shell interpreter to use inside the Lima instance.
24+
- **Default**: User's shell configured inside the instance
25+
- **Usage**:
26+
```sh
27+
export LIMA_SHELL=/bin/bash
28+
lima
29+
```
30+
- **Used in**: `cmd/lima`, `cmd/limactl/shell.go`
31+
32+
### `LIMA_WORKDIR`
33+
34+
- **Description**: Specifies the initial working directory inside the Lima instance.
35+
- **Default**: Current directory from the host
36+
- **Usage**:
37+
```sh
38+
export LIMA_WORKDIR=/home/user/project
39+
lima
40+
```
41+
- **Used in**: `cmd/lima`, `cmd/limactl/shell.go`
42+
43+
### `LIMACTL`
44+
45+
- **Description**: Specifies the path to the `limactl` binary.
46+
- **Default**: `limactl` in `$PATH`
47+
- **Usage**:
48+
```sh
49+
export LIMACTL=/usr/local/bin/limactl
50+
lima
51+
```
52+
- **Used in**: `cmd/lima`, `cmd/lima.bat`
53+
54+
### `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`
55+
56+
- **Description**: Specifies the timeout duration for resolving the IP address in usernet.
57+
- **Default**: 2 minutes
58+
- **Usage**:
59+
```sh
60+
export LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT=5
61+
```
62+
- **Used in**: `cmd/limactl/usernet.go`

0 commit comments

Comments
 (0)