openrag/docs/docs/get-started/docker.mdx
2025-12-05 07:02:33 -08:00

165 lines
No EOL
6 KiB
Text

---
title: Deploy OpenRAG with self-managed services
slug: /docker
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import PartialOnboarding from '@site/docs/_partial-onboarding.mdx';
import PartialPrereqCommon from '@site/docs/_partial-prereq-common.mdx';
import PartialPrereqNoScript from '@site/docs/_partial-prereq-no-script.mdx';
import PartialPrereqWindows from '@site/docs/_partial-prereq-windows.mdx';
import PartialPrereqPython from '@site/docs/_partial-prereq-python.mdx';
import PartialInstallNextSteps from '@site/docs/_partial-install-next-steps.mdx';
To manage your own OpenRAG services, deploy OpenRAG with Docker or Podman.
Use this installation method if you don't want to [use the Terminal User Interface (TUI)](/tui), or you need to run OpenRAG in an environment where using the TUI is unfeasible.
## Prerequisites
<PartialPrereqWindows />
<PartialPrereqCommon />
<PartialPrereqPython />
<PartialPrereqNoScript />
## Install OpenRAG with Docker Compose
To install OpenRAG with Docker Compose, do the following:
1. Clone the OpenRAG repository.
```bash
git clone https://github.com/langflow-ai/openrag.git
cd openrag
```
2. Install dependencies.
```bash
uv sync
```
3. Copy the example `.env` file included in the repository root.
The example file includes all environment variables with comments to guide you in finding and setting their values.
```bash
cp .env.example .env
```
Alternatively, create a new `.env` file in the repository root.
```
touch .env
```
4. The Docker Compose files are populated with the values from your `.env` file.
The `OPENSEARCH_PASSWORD` value must be set.
`OPENSEARCH_PASSWORD` can be automatically generated when using the TUI, but for a Docker Compose installation, you can set it manually instead. To generate an OpenSearch admin password, see the [OpenSearch documentation](https://docs.opensearch.org/latest/security/configuration/demo-configuration/#setting-up-a-custom-admin-password).
The following values are optional:
```env
OPENAI_API_KEY=your_openai_api_key
LANGFLOW_SECRET_KEY=your_secret_key
```
`OPENAI_API_KEY` is optional. You can provide it during [application onboarding](#application-onboarding) or choose a different model provider. If you want to set it in your `.env` file, you can find your OpenAI API key in your [OpenAI account](https://platform.openai.com/api-keys).
`LANGFLOW_SECRET_KEY` is optional. Langflow will auto-generate it if not set. For more information, see the [Langflow documentation](https://docs.langflow.org/api-keys-and-authentication#langflow-secret-key).
The following Langflow configuration values are optional but important to consider:
```env
LANGFLOW_SUPERUSER=admin
LANGFLOW_SUPERUSER_PASSWORD=your_langflow_password
```
`LANGFLOW_SUPERUSER` defaults to `admin`. You can omit it or set it to a different username. `LANGFLOW_SUPERUSER_PASSWORD` is optional. If omitted, Langflow runs in [autologin mode](https://docs.langflow.org/api-keys-and-authentication#langflow-auto-login) with no password required. If set, Langflow requires password authentication.
For more information on configuring OpenRAG with environment variables, see [Environment variables](/reference/configuration).
5. Start `docling serve` on the host machine.
OpenRAG Docker installations require that `docling serve` is running on port 5001 on the host machine.
This enables [Mac MLX](https://opensource.apple.com/projects/mlx/) support for document processing.
```bash
uv run python scripts/docling_ctl.py start --port 5001
```
6. Confirm `docling serve` is running.
```
uv run python scripts/docling_ctl.py status
```
Make sure the response shows that `docling serve` is running, for example:
```bash
Status: running
Endpoint: http://127.0.0.1:5001
Docs: http://127.0.0.1:5001/docs
PID: 27746
```
7. Deploy OpenRAG locally with the appropriate Docker Compose file for your environment.
Both files deploy the same services.
* [`docker-compose.yml`](https://github.com/langflow-ai/openrag/blob/main/docker-compose.yml) is an OpenRAG deployment with GPU support for accelerated AI processing. This Docker Compose file requires an NVIDIA GPU with [CUDA](https://docs.nvidia.com/cuda/) support.
* Docker:
```bash
docker compose build
docker compose up -d
```
* Podman Compose:
```bash
podman compose build
podman compose up -d
```
* [`docker-compose-cpu.yml`](https://github.com/langflow-ai/openrag/blob/main/docker-compose-cpu.yml) is a CPU-only version of OpenRAG for systems without NVIDIA GPU support. Use this Docker Compose file for environments where GPU drivers aren't available.
* Docker:
```bash
docker compose -f docker-compose-cpu.yml up -d
```
* Podman Compose:
```bash
podman compose -f docker-compose-cpu.yml up -d
```
The OpenRAG Docker Compose file starts five containers:
| Container Name | Default address | Purpose |
|---|---|---|
| OpenRAG Backend | http://localhost:8000 | FastAPI server and core functionality. |
| OpenRAG Frontend | http://localhost:3000 | React web interface for user interaction. |
| Langflow | http://localhost:7860 | [AI workflow engine](/agents). |
| OpenSearch | http://localhost:9200 | Datastore for [knowledge](/knowledge). |
| OpenSearch Dashboards | http://localhost:5601 | OpenSearch database administration interface. |
8. Wait while the containers start, and then confirm all containers are running:
* Docker Compose:
```bash
docker compose ps
```
* Podman Compose:
```bash
podman compose ps
```
If all containers are running, you can access your OpenRAG services at their addresses.
9. Access the OpenRAG frontend at `http://localhost:3000` to continue with [application onboarding](#application-onboarding).
<PartialOnboarding />
<PartialInstallNextSteps />