Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variables documentation #2526

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/docker.lima
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/sh
set -eu

# Environment Variables
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "docker".

: "${LIMA_INSTANCE:=docker}"
: "${DOCKER:=docker}"

Expand Down
4 changes: 4 additions & 0 deletions cmd/kubectl.lima
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/sh
set -eu

# Environment Variables
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is empty.

: "${LIMA_INSTANCE:=}"
: "${KUBECTL:=kubectl}"

Expand Down
7 changes: 7 additions & 0 deletions cmd/lima
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh
set -eu

# Environment Variables
# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default".
# LIMA_SHELL: Specifies the shell interpreter to use inside the Lima instance. Default is the user's shell configured inside the instance.
# LIMA_WORKDIR: Specifies the initial working directory inside the Lima instance. Default is the current directory from the host.
# LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in $PATH.

: "${LIMA_INSTANCE:=default}"
: "${LIMA_SHELL:=}"
: "${LIMA_WORKDIR:=}"
Expand Down
12 changes: 8 additions & 4 deletions cmd/lima.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
@echo off
IF NOT DEFINED LIMACTL (SET LIMACTL=limactl)
IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default)
%LIMACTL% shell %LIMA_INSTANCE% %*
@echo off
REM Environment Variables
REM LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is "default".
REM LIMACTL: Specifies the path to the limactl binary. Default is "limactl" in %PATH%.

IF NOT DEFINED LIMACTL (SET LIMACTL=limactl)
IF NOT DEFINED LIMA_INSTANCE (SET LIMA_INSTANCE=default)
%LIMACTL% shell %LIMA_INSTANCE% %*
3 changes: 3 additions & 0 deletions cmd/limactl/usernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func usernetAction(cmd *cobra.Command, _ []string) error {
os.RemoveAll(qemuSocket)
os.RemoveAll(fdSocket)

// Environment Variables
// LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT: Specifies the timeout duration for resolving IP addresses in minutes. Default is 2 minutes.

return usernet.StartGVisorNetstack(cmd.Context(), &usernet.GVisorNetstackOpts{
MTU: mtu,
Endpoint: endpoint,
Expand Down
2 changes: 2 additions & 0 deletions website/content/en/docs/config/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ The current default spec:
- Disk: 100 GiB
- Mounts: `~` (read-only), `/tmp/lima` (writable)
- SSH: 127.0.0.1:60022

For environment variables, see [Environment Variables](./environment-variables/).
57 changes: 57 additions & 0 deletions website/content/en/docs/config/environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Environment Variables
weight: 6
---

## Environment Variables

This page documents the environment variables used in Lima.

### `LIMA_INSTANCE`

- **Description**: Specifies the name of the Lima instance to use.
- **Default**: `default`
- **Usage**:
```sh
export LIMA_INSTANCE=my-instance
lima uname -a
```

### `LIMA_SHELL`

- **Description**: Specifies the shell interpreter to use inside the Lima instance.
- **Default**: User's shell configured inside the instance
- **Usage**:
```sh
export LIMA_SHELL=/bin/bash
lima
```

### `LIMA_WORKDIR`

- **Description**: Specifies the initial working directory inside the Lima instance.
- **Default**: Current directory from the host
- **Usage**:
```sh
export LIMA_WORKDIR=/home/user/project
lima
```

### `LIMACTL`

- **Description**: Specifies the path to the `limactl` binary.
- **Default**: `limactl` in `$PATH`
- **Usage**:
```sh
export LIMACTL=/usr/local/bin/limactl
lima
```

### `LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT`

- **Description**: Specifies the timeout duration for resolving the IP address in usernet.
- **Default**: 2 minutes
- **Usage**:
```sh
export LIMA_USERNET_RESOLVE_IP_ADDRESS_TIMEOUT=5
```
Loading