|
| 1 | +<!-- Source: docling-serve@v1.21.0 — keep in sync on serve releases that touch config/deployment/usage. --> |
| 2 | +!!! info "Synced from docling-serve v1.21.0" |
| 3 | + This page summarizes the [docling-serve](https://github.com/docling-project/docling-serve) documentation at **v1.21.0**. For the exhaustive reference, follow the links to the source repository. |
| 4 | + |
| 5 | +# Deployment |
| 6 | + |
| 7 | +Get docling-serve running on one machine fast. For cluster/production hardening, follow the links to the [docling-serve repo](https://github.com/docling-project/docling-serve/tree/v1.21.0/docs). |
| 8 | + |
| 9 | +Two independent choices shape how you run it: |
| 10 | + |
| 11 | +- **How you start the process** — the `docling-serve` command, or **Docker Compose**. |
| 12 | +- **Which [compute engine](#compute-engines) runs the jobs** (`DOCLING_SERVE_ENG_KIND`) — the in-process **Local** engine (default), or the Redis-backed **RQ** engine. |
| 13 | + |
| 14 | +| | Local engine (default) | RQ engine (Redis + workers) | |
| 15 | +|---|---|---| |
| 16 | +| **`docling-serve` command** | Quickstart / dev | Distributed | |
| 17 | +| **Docker Compose** | Containerized single node (+GPU) | → [serve repo](https://github.com/docling-project/docling-serve/tree/v1.21.0/docs/deploy-examples) | |
| 18 | + |
| 19 | +## Configuration |
| 20 | + |
| 21 | +docling-serve is configured by **CLI flags or environment variables**. Precedence is **environment variable > config file > defaults**. |
| 22 | + |
| 23 | +!!! warning "Subprocess gotcha" |
| 24 | + When uvicorn runs with `--reload` or `--workers > 1` it spawns subprocesses, and CLI flags (e.g. `--enable-ui`, `--artifacts-path`) are ignored. Use the `DOCLING_SERVE_*` environment variables in those deployments. |
| 25 | + |
| 26 | +### Most common settings |
| 27 | + |
| 28 | +| Setting (env var) | What it does | Default | |
| 29 | +|---|---|---| |
| 30 | +| `UVICORN_HOST` / `UVICORN_PORT` | bind address / port | `0.0.0.0` / `5001` | |
| 31 | +| `UVICORN_WORKERS` | uvicorn worker processes | `1` | |
| 32 | +| `DOCLING_SERVE_API_KEY` | require an `X-Api-Key` header | unset | |
| 33 | +| `DOCLING_SERVE_ENABLE_UI` | serve the Gradio demo UI at `/ui` | `false` | |
| 34 | +| `DOCLING_SERVE_ARTIFACTS_PATH` | local path to pre-downloaded models | unset (auto-download) | |
| 35 | +| `DOCLING_SERVE_MAX_NUM_PAGES` / `DOCLING_SERVE_MAX_FILE_SIZE` | per-request limits | unset | |
| 36 | +| `DOCLING_SERVE_ENG_KIND` | async engine: `local` or `rq` (also `kfp`/`ray` — see serve repo) | `local` | |
| 37 | + |
| 38 | +See the full reference in the source repo: [`configuration.md`](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/configuration.md) and [`.env.example`](https://github.com/docling-project/docling-serve/blob/v1.21.0/.env.example). |
| 39 | + |
| 40 | +### Docling settings (env vars) |
| 41 | + |
| 42 | +These tune Docling itself and are read by the server too: |
| 43 | + |
| 44 | +| Env var | What it does | Default | |
| 45 | +|---|---|---| |
| 46 | +| `DOCLING_DEVICE` | inference device: `cpu` / `cuda` / `mps` | auto | |
| 47 | +| `DOCLING_NUM_THREADS` | CPU threads | runtime default | |
| 48 | +| `DOCLING_PERF_PAGE_BATCH_SIZE` | pages per batch | runtime default | |
| 49 | +| `DOCLING_PERF_ELEMENTS_BATCH_SIZE` | elements per batch | runtime default | |
| 50 | +| `DOCLING_DEBUG_PROFILE_PIPELINE_TIMINGS` | log per-stage timings | `false` | |
| 51 | + |
| 52 | +For how to *choose* device/perf values see [GPU support](../gpu.md). For offline / air-gapped model setup see the [FAQ](../../faq/index.md) and [Advanced options](../advanced_options.md); set `DOCLING_SERVE_ARTIFACTS_PATH` to a pre-populated model directory. |
| 53 | + |
| 54 | +## Compute engines |
| 55 | + |
| 56 | +docling-serve runs each conversion as an asynchronous job dispatched to a **compute engine**, chosen with `DOCLING_SERVE_ENG_KIND`: |
| 57 | + |
| 58 | +- **Local** (`local`, the default) — jobs run in an in-process thread pool inside the server. No external services; everything stays on one host. Tunable with `DOCLING_SERVE_ENG_LOC_NUM_WORKERS` (default `2`) and `DOCLING_SERVE_ENG_LOC_SHARE_MODELS` (default `false`). Best for a single machine. |
| 59 | +- **RQ** (`rq`) — jobs are queued in **Redis** and executed by separate `docling-serve rq-worker` processes, so the API tier and the conversion workers scale independently. Best for horizontal scaling and higher throughput. |
| 60 | +- **KFP / Ray** — Kubeflow Pipelines and Ray engines for cluster orchestration; see the [serve repo](https://github.com/docling-project/docling-serve/tree/v1.21.0/docs). |
| 61 | + |
| 62 | +## Running it |
| 63 | + |
| 64 | +### Simple command (Local engine — the default quickstart) |
| 65 | + |
| 66 | +```sh |
| 67 | +pip install "docling-serve[ui]" |
| 68 | +docling-serve run --enable-ui # production-style: reload off, binds 0.0.0.0, UI off by default |
| 69 | +# docling-serve dev # dev: auto-reload, binds 127.0.0.1, UI on (localhost only) |
| 70 | +``` |
| 71 | + |
| 72 | +API at `http://localhost:5001`, interactive docs at `/docs`, demo UI at `/ui`. Smoke test: |
| 73 | + |
| 74 | +```sh |
| 75 | +curl -X POST "http://localhost:5001/v1/convert/source/async" \ |
| 76 | + -H "Content-Type: application/json" \ |
| 77 | + -d '{"http_sources": [{"url": "https://arxiv.org/pdf/2501.17887"}]}' |
| 78 | +``` |
| 79 | + |
| 80 | +!!! note |
| 81 | + The demo UI (`--enable-ui` / `DOCLING_SERVE_ENABLE_UI`) is a Gradio app; files it produces are cleared from its cache after ~10 hours. It is a demonstrator, not durable storage. |
| 82 | + |
| 83 | +### Docker Compose (incl. local GPU) |
| 84 | + |
| 85 | +Same server, containerized. The shipped compose examples are all-in-one containers that don't set `ENG_KIND`, so they run the default Local engine. |
| 86 | + |
| 87 | +```sh |
| 88 | +# Pure CPU (no compose) |
| 89 | +podman run -p 5001:5001 -e DOCLING_SERVE_ENABLE_UI=1 quay.io/docling-project/docling-serve |
| 90 | + |
| 91 | +# NVIDIA GPU |
| 92 | +docker compose -f compose-nvidia.yaml up -d |
| 93 | + |
| 94 | +# AMD GPU |
| 95 | +docker compose -f compose-amd.yaml up -d |
| 96 | +``` |
| 97 | + |
| 98 | +Compose manifests: [`compose-nvidia.yaml`](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/compose-nvidia.yaml), [`compose-amd.yaml`](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/compose-amd.yaml). |
| 99 | + |
| 100 | +**GPU prerequisites** (host side; for the Python `AcceleratorOptions` view see [GPU support](../gpu.md) and [RTX GPU](../../getting_started/rtx.md)): |
| 101 | + |
| 102 | +- NVIDIA — driver ≥ 550.54.14 + `nvidia-container-toolkit` + the nvidia container runtime. |
| 103 | +- AMD — AMDGPU/ROCm ≥ 6.3; the ROCm image is **not published**, build it with `make docling-serve-rocm-image`. Detailed GID wiring: [serve repo](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deployment.md). |
| 104 | + |
| 105 | +!!! note |
| 106 | + The compose files pin older image tags (`-cu126:main`, `-rocm72:main`) than the README image table; treat the [README image table](https://github.com/docling-project/docling-serve/blob/v1.21.0/README.md) as the source of truth and adjust the `image:` line if needed. There is no shipped single-CPU compose file — use the `podman` one-liner for pure CPU. |
| 107 | + |
| 108 | +### RQ engine (distributed: Redis + separate workers) |
| 109 | + |
| 110 | +The API enqueues jobs to Redis; conversion runs in separate `docling-serve rq-worker` processes. |
| 111 | + |
| 112 | +```sh |
| 113 | +# 1) Redis |
| 114 | +docker run -p 6379:6379 redis:7-alpine |
| 115 | + |
| 116 | +# 2) API server (enqueues jobs) |
| 117 | +DOCLING_SERVE_ENG_KIND=rq \ |
| 118 | +DOCLING_SERVE_ENG_RQ_REDIS_URL=redis://localhost:6379/0 \ |
| 119 | +docling-serve run |
| 120 | + |
| 121 | +# 3) one or more workers (do the conversion) |
| 122 | +DOCLING_SERVE_ENG_KIND=rq \ |
| 123 | +DOCLING_SERVE_ENG_RQ_REDIS_URL=redis://localhost:6379/0 \ |
| 124 | +docling-serve rq-worker |
| 125 | +``` |
| 126 | + |
| 127 | +!!! warning |
| 128 | + The API alone *accepts* jobs but nothing runs them without at least one `rq-worker`. `DOCLING_SERVE_ENG_RQ_REDIS_URL` is required (no default) and must be identical across every API and worker process. |
| 129 | + |
| 130 | +## Cluster, production & advanced variants |
| 131 | + |
| 132 | +These live in the docling-serve repo (run-time manifests aren't vendored here): |
| 133 | + |
| 134 | +- [OpenShift — simple deployment](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/docling-serve-simple.yaml) |
| 135 | +- [Multi-worker RQ on Kubernetes](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/docling-serve-rq-workers.yaml) (Redis + worker pods + secret) |
| 136 | +- [Secure deployment with oauth-proxy / TLS / Route](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/docling-serve-oauth.yaml) |
| 137 | +- [ReplicaSets with sticky sessions](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/deploy-examples/docling-serve-replicas-w-sticky-sessions.yaml) (task state is node-local) |
| 138 | +- [Model-cache PVC/Job](https://github.com/docling-project/docling-serve/blob/v1.21.0/docs/models.md) (pre-baking weights) |
| 139 | +- KFP / Ray engines, OpenTelemetry, CUDA image-tagging policy → [serve repo](https://github.com/docling-project/docling-serve/tree/v1.21.0/docs) |
| 140 | + |
| 141 | +Prefer not to run any of this yourself? See the [managed service](managed.md). |
0 commit comments