> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/open-webui/open-webui/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Complete installation guide for Open WebUI using Docker, pip, and Kubernetes

# Installing Open WebUI

Open WebUI supports multiple installation methods to suit your deployment needs. Choose the method that best fits your infrastructure and requirements.

<Note>
  Before installing, ensure you're using **Python 3.11 or 3.12** for pip installations. Docker installations work on any system with Docker installed.
</Note>

## Installation Methods

<CardGroup cols={2}>
  <Card title="Docker" icon="docker" href="#docker-installation">
    Recommended for most users - quick and isolated
  </Card>

  <Card title="Python pip" icon="python" href="#python-pip-installation">
    Direct installation using Python package manager
  </Card>

  <Card title="Docker Compose" icon="layer-group" href="#docker-compose">
    Multi-container setup with Ollama included
  </Card>

  <Card title="Kubernetes" icon="dharmachakra" href="#kubernetes">
    Production deployments with kubectl, kustomize, or helm
  </Card>
</CardGroup>

***

## Docker Installation

Docker is the recommended installation method for most users, providing isolation and easy management.

<Warning>
  When using Docker to install Open WebUI, make sure to include the `-v open-webui:/app/backend/data` in your Docker command. This step is crucial as it ensures your database is properly mounted and prevents any loss of data.
</Warning>

### Prerequisites

* Docker installed on your system
* (Optional) NVIDIA CUDA container toolkit for GPU support

### With Local Ollama

If Ollama is running on your computer:

```bash theme={null}
docker run -d -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main
```

Access Open WebUI at [http://localhost:3000](http://localhost:3000)

### With Remote Ollama

If Ollama is on a different server:

```bash theme={null}
docker run -d -p 3000:8080 \
  -e OLLAMA_BASE_URL=https://example.com \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main
```

### With GPU Support (NVIDIA)

To run Open WebUI with Nvidia GPU support:

<Tip>
  You must install the [Nvidia CUDA container toolkit](https://docs.nvidia.com/dgx/nvidia-container-runtime-upgrade/) on your Linux/WSL system before using the `:cuda` image.
</Tip>

```bash theme={null}
docker run -d -p 3000:8080 \
  --gpus all \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:cuda
```

### OpenAI API Only

If you're only using OpenAI API:

```bash theme={null}
docker run -d -p 3000:8080 \
  -e OPENAI_API_KEY=your_secret_key \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main
```

### Bundled with Ollama

This installation method uses a single container image that bundles Open WebUI with Ollama:

<CodeGroup>
  ```bash With GPU theme={null}
  docker run -d -p 3000:8080 \
    --gpus=all \
    -v ollama:/root/.ollama \
    -v open-webui:/app/backend/data \
    --name open-webui \
    --restart always \
    ghcr.io/open-webui/open-webui:ollama
  ```

  ```bash CPU Only theme={null}
  docker run -d -p 3000:8080 \
    -v ollama:/root/.ollama \
    -v open-webui:/app/backend/data \
    --name open-webui \
    --restart always \
    ghcr.io/open-webui/open-webui:ollama
  ```
</CodeGroup>

***

## Python pip Installation

Install Open WebUI directly using pip for development or custom deployments.

<Warning>
  Before proceeding, ensure you're using **Python 3.11 or 3.12** to avoid compatibility issues.
</Warning>

<Steps>
  <Step title="Install Open WebUI">
    Open your terminal and run:

    ```bash theme={null}
    pip install open-webui
    ```
  </Step>

  <Step title="Run Open WebUI">
    After installation, start the server:

    ```bash theme={null}
    open-webui serve
    ```

    The server will start and be accessible at [http://localhost:8080](http://localhost:8080)
  </Step>
</Steps>

### With PostgreSQL Support

To install with PostgreSQL support:

```bash theme={null}
pip install open-webui[postgres]
```

### With All Optional Dependencies

For a complete installation with all optional features:

```bash theme={null}
pip install open-webui[all]
```

***

## Docker Compose

Docker Compose provides a convenient way to run Open WebUI with Ollama in a multi-container setup.

<Steps>
  <Step title="Create docker-compose.yaml">
    Create a `docker-compose.yaml` file with the following content:

    ```yaml theme={null}
    services:
      ollama:
        volumes:
          - ollama:/root/.ollama
        container_name: ollama
        pull_policy: always
        tty: true
        restart: unless-stopped
        image: ollama/ollama:latest

      open-webui:
        image: ghcr.io/open-webui/open-webui:main
        container_name: open-webui
        volumes:
          - open-webui:/app/backend/data
        depends_on:
          - ollama
        ports:
          - 3000:8080
        environment:
          - 'OLLAMA_BASE_URL=http://ollama:11434'
          - 'WEBUI_SECRET_KEY='
        extra_hosts:
          - host.docker.internal:host-gateway
        restart: unless-stopped

    volumes:
      ollama: {}
      open-webui: {}
    ```
  </Step>

  <Step title="Start the services">
    Run the following command:

    ```bash theme={null}
    docker compose up -d
    ```
  </Step>

  <Step title="Access Open WebUI">
    Open your browser and navigate to [http://localhost:3000](http://localhost:3000)
  </Step>
</Steps>

***

## Kubernetes

Deploy Open WebUI in Kubernetes for production-grade scalability and reliability.

<Note>
  Kubernetes deployments support kubectl, kustomize, and Helm. Refer to the Open WebUI documentation for detailed Kubernetes deployment guides.
</Note>

### Environment Configuration

For Kubernetes deployments, set the `K8S_FLAG` environment variable:

```yaml theme={null}
env:
  - name: K8S_FLAG
    value: "true"
  - name: OLLAMA_BASE_URL
    value: "http://ollama-service.open-webui.svc.cluster.local:11434"
```

***

## Network Configuration

### Using Host Network

If you're experiencing connection issues, use the `--network=host` flag. Note that the port changes from 3000 to 8080:

```bash theme={null}
docker run -d --network=host \
  -v open-webui:/app/backend/data \
  -e OLLAMA_BASE_URL=http://127.0.0.1:11434 \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main
```

Access at [http://localhost:8080](http://localhost:8080)

***

## Using Dev Branch

<Warning>
  The `:dev` branch contains the latest unstable features and changes. Use it at your own risk as it may have bugs or incomplete features.
</Warning>

To try bleeding-edge features:

```bash theme={null}
docker run -d -p 3000:8080 \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --add-host=host.docker.internal:host-gateway \
  --restart always \
  ghcr.io/open-webui/open-webui:dev
```

***

## Offline Mode

If running Open WebUI in an offline environment, set the `HF_HUB_OFFLINE` environment variable:

```bash theme={null}
export HF_HUB_OFFLINE=1
```

Or in Docker:

```bash theme={null}
docker run -d -p 3000:8080 \
  -e HF_HUB_OFFLINE=1 \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main
```

***

## Environment Variables

Key environment variables for installation:

| Variable              | Description                  | Default                  |
| --------------------- | ---------------------------- | ------------------------ |
| `OLLAMA_BASE_URL`     | URL for Ollama server        | `http://localhost:11434` |
| `OPENAI_API_KEY`      | OpenAI API key               | -                        |
| `OPENAI_API_BASE_URL` | OpenAI API base URL          | -                        |
| `WEBUI_SECRET_KEY`    | Secret key for sessions      | Generated                |
| `DATA_DIR`            | Data directory path          | `/app/backend/data`      |
| `HF_HUB_OFFLINE`      | Offline mode for HuggingFace | `false`                  |

See the [Configuration Guide](/configuration) for a complete list of environment variables.

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Get started with your first chat
  </Card>

  <Card title="Configuration" icon="gear" href="/configuration">
    Configure Open WebUI settings
  </Card>
</CardGroup>

## Troubleshooting

**Connection Issues**

If you experience connection issues, the WebUI docker container may not be able to reach the Ollama server. Try using `--network=host` or verify your `OLLAMA_BASE_URL` setting.

**Data Persistence**

Always use volume mounts (`-v open-webui:/app/backend/data`) to ensure data persistence across container restarts.

**GPU Not Detected**

Ensure the NVIDIA CUDA container toolkit is properly installed and use the `:cuda` tagged image.

For more troubleshooting help, visit the [Open WebUI Documentation](https://docs.openwebui.com/troubleshooting/) or join our [Discord community](https://discord.gg/5rJgQTnV4s).
