Skip to content

Commit c8279f7

Browse files
authored
Merge pull request #2526 from SmartManoj/add-environment-variables
Add environment variables documentation
2 parents 64c3c41 + 9faad41 commit c8279f7

File tree

7 files changed

+85
-4
lines changed

7 files changed

+85
-4
lines changed

cmd/docker.lima

Lines changed: 4 additions & 0 deletions
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 "docker".
6+
37
: "${LIMA_INSTANCE:=docker}"
48
: "${DOCKER:=docker}"
59

cmd/kubectl.lima

Lines changed: 4 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 8 additions & 4 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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/).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
20+
### `LIMA_SHELL`
21+
22+
- **Description**: Specifies the shell interpreter to use inside the Lima instance.
23+
- **Default**: User's shell configured inside the instance
24+
- **Usage**:
25+
```sh
26+
export LIMA_SHELL=/bin/bash
27+
lima
28+
```
29+
30+
### `LIMA_WORKDIR`
31+
32+
- **Description**: Specifies the initial working directory inside the Lima instance.
33+
- **Default**: Current directory from the host
34+
- **Usage**:
35+
```sh
36+
export LIMA_WORKDIR=/home/user/project
37+
lima
38+
```
39+
40+
### `LIMACTL`
41+
42+
- **Description**: Specifies the path to the `limactl` binary.
43+
- **Default**: `limactl` in `$PATH`
44+
- **Usage**:
45+
```sh
46+
export LIMACTL=/usr/local/bin/limactl
47+
lima
48+
```
49+
50+
### `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`
51+
52+
- **Description**: Specifies the timeout duration for resolving the IP address in usernet.
53+
- **Default**: 2 minutes
54+
- **Usage**:
55+
```sh
56+
export LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT=5
57+
```

0 commit comments

Comments
 (0)