Terminals (Orchestrator)
Terminals manages Open Terminal instances for a team. Each instance is a container where the AI runs commands and works with files. An instance can belong to a user, a chat or a model, or be shared by everyone, with its own files, processes, packages, resource limits, network profile and optional persistent storage.
Open Terminal gives an Open WebUI chat a real workspace to act in. Terminals manages those workspaces for many people, so everyone gets the right one without hand-wiring containers. Open WebUI is where you create, share and use terminals. Terminals starts, reuses and cleans up the instances behind them.
Terminals can give every person, chat or model its own workspace, so files and processes never mix. It also offers ready-made environments: set an image, resources, a start directory and a setup script once, then share the terminal with a group. Idle instances are cleaned up after the idle timeout you set. It is for admins who run Open WebUI for a team. Use it when one shared Open Terminal is not enough because people need separate files, tools and limits.
- Need to operate per-user terminal environments? → Orchestration
- Need to create and share terminals? → Creating Terminals
How It Works
The orchestrator sits between Open WebUI and the Open Terminal instances:
- A user activates Open Terminal in Open WebUI.
- Open WebUI proxies the request to the orchestrator, which manages workspace lifecycle.
- The orchestrator reads the selected terminal: image, resources, storage, env vars, start directory, setup script and instance scope.
- The orchestrator provisions or reuses the matching Open Terminal instance: one per user, chat or model, or a single one for everyone, depending on the terminal's instance scope.
- All traffic goes through the orchestrator.
- Idle instances are cleaned up after the idle timeout you set. Files in the home folder are kept: Docker keeps them in the data folder, Kubernetes keeps them on a persistent volume when storage is enabled.
The orchestrator exposes the same OpenAPI-based tool interface as Open Terminal, so the AI can work with files, run code, execute commands, start servers and inspect results, all inside the instance the terminal's scope selects.
Why It Matters
Terminals lets admins give agents enough environment to do real work while controlling its limits:
| Need | What Terminals provides |
|---|---|
| Isolation | Separate files and processes per instance, with one instance per user, saved chat or model when the terminal asks for it |
| Governance | Terminals with set images, env vars, resource limits and storage, checked against server maximums, and shared only with chosen users and groups |
| Repeatability | Custom images and startup packages so users get the right tools every time |
| Lifecycle | Reuse, idle cleanup and start, stop, restart and delete per instance |
| Scale | Docker for a single host, Kubernetes/operator mode for larger deployments |
| Supportability | Admin UI, logs, status, templates API and predictable routing |
The orchestrator serves a built-in minimal admin UI at / with Templates (create and edit terminals, reset schedules, delete) and Environments (inspect instances, including stopped ones, and start, stop, restart, reset or delete them). It signs in with TERMINALS_API_KEY. It is on by default and toggled with TERMINALS_ENABLE_UI; set it to false for API-only deployments.
Deployment
- Docker
- Kubernetes Operator
Prerequisites
- Docker Engine installed and running
- Open WebUI running (or ready to deploy alongside)
- Open WebUI Enterprise License (required for production use)
Quick start with Docker Compose
This Compose file deploys Open WebUI and the Terminals orchestrator together.
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
environment:
- >-
TERMINAL_SERVER_CONNECTIONS=[{
"id": "terminals",
"name": "Terminals",
"enabled": true,
"url": "http://terminals:3000",
"key": "${TERMINALS_API_KEY}",
"auth_type": "bearer",
"server_type": "orchestrator",
"config": {
"access_grants": [{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
}]
}
}]
volumes:
- open-webui:/app/backend/data
networks:
- webui
depends_on:
- terminals
terminals:
image: ghcr.io/open-webui/terminals:latest
environment:
- TERMINALS_BACKEND=docker
- TERMINALS_API_KEY=${TERMINALS_API_KEY}
- TERMINALS_IMAGE=ghcr.io/open-webui/open-terminal:latest
- TERMINALS_DOCKER_NETWORK=open-webui-network
- TERMINALS_DOCKER_HOST_DATA_DIR=${PWD}/data/terminals
- TERMINALS_IDLE_TIMEOUT_MINUTES=30
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/app/data
networks:
- webui
volumes:
open-webui:
networks:
webui:
name: open-webui-networkTerminals keeps its database and the files of every instance in the data folder next to your Compose file. TERMINALS_DOCKER_HOST_DATA_DIR tells Docker where that folder lives on the host, so the instance containers mount the same files the orchestrator manages.
Set the shared API key in a .env file next to your Compose file:
TERMINALS_API_KEY=change-me-to-a-strong-random-value
Then start everything:
docker compose up -dOpen WebUI will be available at http://localhost:3000. The connection above gives every user Read access, so users can use terminals that are shared with them. Give the people who create terminals Write access in the connection's Access setting, see Creating Terminals. When a user opens a terminal, the orchestrator provisions the instance automatically.
The orchestrator needs access to the Docker socket (/var/run/docker.sock) to manage containers. For production, use a Docker socket proxy like Tecnativa/docker-socket-proxy to restrict the API calls it can make.
The orchestrator settings for this deployment, such as TERMINALS_DOCKER_NETWORK, TERMINALS_DOCKER_DATA_DIR and TERMINALS_IDLE_TIMEOUT_MINUTES, are listed in Orchestrator Environment Variables.
Container lifecycle details
Filtering. Containers are easy to filter with docker ps --filter "label=app.kubernetes.io/managed-by=terminals".
Startup. After creating a container, the orchestrator waits until the container answers, for up to 15 seconds, and then starts proxying traffic. It logs a warning if the container was not ready in time.
Limitations
- Single host. All user containers run on one Docker host. For high availability or larger teams, use the Kubernetes Operator backend.
- No built-in HA. If the orchestrator goes down, active terminal sessions are interrupted (though containers keep running and are reconciled on restart).
- Docker socket required. The orchestrator needs access to the Docker socket to manage containers.
Prerequisites
- A running Kubernetes cluster
- Helm v3 installed
kubectlconfigured to access your cluster- Open WebUI Enterprise License (required for production use)
Deploy with Helm
The Open WebUI Helm chart includes Terminals as an optional subchart. Add a terminals section to your values file:
# values.yaml
terminals:
enabled: true
apiKey: "" # Auto-generated if left empty
crd:
install: false # install the CRD from the Terminals repository, see below
operator:
image:
repository: ghcr.io/open-webui/terminals-operator
tag: latest
orchestrator:
image:
repository: ghcr.io/open-webui/terminals
tag: latest
backend: kubernetes-operator
terminalImage: "ghcr.io/open-webui/open-terminal:latest"
idleTimeoutMinutes: 30Then install or upgrade:
helm upgrade --install open-webui open-webui/open-webui \
-f values.yaml \
--namespace open-webui --create-namespaceWhen terminals.enabled is true, the chart sets TERMINAL_SERVER_CONNECTIONS to point at the in-cluster orchestrator. In Settings > Integrations (admin section), open the connection and save it once, so Open WebUI detects it as an orchestrator. Give the people who create terminals Write access in the connection's Access setting, see Creating Terminals.
The Terminal CRD must define spec.templateId. The CRD bundled with the Helm chart requires spec.userId, so install the CRD from the Terminals repository for your Terminals version and set terminals.crd.install: false.
Verify
# Check that all pods are running
kubectl get pods -n open-webui -l app.kubernetes.io/part-of=open-terminal
# Check that the CRD is installed
kubectl get crd terminals.openwebui.comWhat gets deployed
When terminals.enabled: true, the chart creates:
| Resource | Purpose |
|---|---|
CRD (terminals.openwebui.com) | Defines the Terminal custom resource |
| Operator Deployment | Kopf controller that watches Terminal CRs and provisions Pods, Services, PVCs, Secrets |
| Orchestrator Deployment + Service | FastAPI service that receives requests from Open WebUI and proxies to the instance Pods |
| Secret | Shared API key (auto-generated if not provided) |
For each instance, the operator creates a Pod, Service, Secret (API key) and optionally a PVC for persistent storage.
Lifecycle
When an instance is needed, the orchestrator creates a Terminal CR. The operator provisions a Pod with a Service, Secret and optional PVC. Once the Pod passes readiness checks, the orchestrator proxies traffic to it.
When an instance has been idle longer than idleTimeoutMinutes, the operator deletes the Pod but keeps the PVC and Secret. On the next request, a fresh Pod is created with the same PVC reattached, so user data persists across idle cycles.
# List all terminals
kubectl get terminals -n open-webui
# Inspect a specific terminal
kubectl describe terminal <name> -n open-webui
# Delete a terminal (its Pod, Service and Secret are removed)
kubectl delete terminal <name> -n open-webuiDeleting a terminal removes its Pod, Service and Secret. The PVC with its files stays until you delete it separately with kubectl delete pvc.
Monitoring
# Operator logs
kubectl logs -n open-webui deployment/<release>-terminals-operator --tail=50
# Orchestrator logs
kubectl logs -n open-webui deployment/<release>-terminals-orchestrator --tail=50Terminal CRD reference
Spec fields
| Field | Type | Default | Description |
|---|---|---|---|
templateId | string | (required) | ID of the terminal this instance belongs to |
contextId | string | default | Which instance of the terminal this is: default, user:<id>, chat:<id> or model:<id> |
image | string | ghcr.io/open-webui/open-terminal:latest | Container image |
imagePullPolicy | string | (Kubernetes default) | Always, IfNotPresent or Never |
resources.requests.cpu | string | (unset) | CPU request. The orchestrator sets limits only |
resources.requests.memory | string | (unset) | Memory request. The orchestrator sets limits only |
resources.limits.cpu | string | (unset) | CPU limit. The orchestrator sets it when the terminal has a CPU limit |
resources.limits.memory | string | (unset) | Memory limit. The orchestrator sets it when the terminal has a memory limit |
idleTimeoutMinutes | integer | 30 | Idle timeout before Pod is stopped, 0 disables it. The orchestrator always sets it from the terminal or TERMINALS_IDLE_TIMEOUT_MINUTES, so the default only applies to hand-written resources |
packages | array | [] | Apt packages to pre-install |
pipPackages | array | [] | Pip packages to pre-install |
env | object | {} | Environment variables passed to the container |
restricted | boolean | false | Restricted Kubernetes and OpenShift pod defaults |
podSecurityContext, containerSecurityContext | object | (unset) | Security contexts copied to the Pod and the container |
podTemplate | object | (unset) | Pod metadata and spec overrides merged into the generated Pod |
persistence.enabled | boolean | true | Enable persistent storage |
persistence.size | string | 1Gi | PVC size |
persistence.storageClass | string | (cluster default) | Storage class |
Status fields
| Field | Description |
|---|---|
phase | Pending, Provisioning, Running, Idle, or Error |
podName | Name of the terminal Pod |
serviceUrl | In-cluster URL for the terminal |
apiKeySecret | Secret holding the terminal's API key |
lastActivityAt | Timestamp of last proxied request |
message | Human-readable status message |
Full Helm values reference
| Key | Default | Description |
|---|---|---|
terminals.enabled | false | Enable the Terminals subchart |
terminals.apiKey | (empty) | Shared API key (auto-generated if empty) |
terminals.existingSecret | (empty) | Pre-existing Secret name (key: api-key) |
terminals.crd.install | true | Install the Terminal CRD |
terminals.operator.image.repository | ghcr.io/open-webui/terminals-operator | Operator image |
terminals.operator.image.tag | latest | Operator image tag |
terminals.operator.replicaCount | 1 | Operator replicas |
terminals.orchestrator.image.repository | ghcr.io/open-webui/terminals | Orchestrator image |
terminals.orchestrator.image.tag | latest | Orchestrator image tag |
terminals.orchestrator.backend | kubernetes-operator | Backend type |
terminals.orchestrator.terminalImage | ghcr.io/open-webui/open-terminal:latest | Default image for user Pods |
terminals.orchestrator.idleTimeoutMinutes | 30 | Idle timeout (minutes) |
terminals.orchestrator.terminalImagePullPolicy | IfNotPresent | Pull policy for the instance image |
terminals.orchestrator.replicaCount | 1 | Orchestrator replicas |
terminals.operator.extraEnvVars, terminals.orchestrator.extraEnvVars | [] | Extra environment variables, as a list or a map |
terminals.networkPolicy.enabled | false | Create NetworkPolicies for the operator, orchestrator and instance Pods |
terminals.orchestrator.service.type | ClusterIP | Orchestrator Service type |
terminals.orchestrator.service.port | 8080 | Orchestrator Service port |
RBAC requirements (manual install only)
If not using the Helm chart, the operator's ServiceAccount needs a ClusterRole with:
| Resource | Verbs |
|---|---|
terminals.openwebui.com | get, list, watch, create, update, patch, delete |
pods, services, persistentvolumeclaims, secrets | get, list, watch, create, update, patch, delete |
events | create |
configmaps, leases | get, list, watch, create, update, patch |
Authentication
Open WebUI and the orchestrator share one API key. Set TERMINALS_API_KEY on the orchestrator, and on the connection in Open WebUI set Auth to Bearer with the same value as API Key. Open WebUI checks who may use a terminal. Terminal requests carry the verified user ID, and the orchestrator accepts requests that carry the key. Keep the key secret: it also opens the built-in admin UI and the templates API.
If TERMINALS_API_KEY is unset, terminals serve generates a key and prints it. The generated key changes on every restart, so set a fixed value for any real deployment.
With Helm the chart generates the shared key and configures it on both sides. With Docker Compose set TERMINALS_API_KEY in a .env file next to the Compose file, see Deployment.
The key covers every call from Open WebUI: Verify Connection, the terminals API and terminal traffic, which also carry the user's ID and the X-Terminal-* headers.
Troubleshooting
Terminal won't start
- Check orchestrator logs. The orchestrator logs the full provisioning flow, including image pull and workspace creation. Look for errors related to image availability, terminal settings or resource limits.
- Verify the API key. Ensure
TERMINALS_API_KEYmatches between Open WebUI and the orchestrator. A mismatch makes the connection fail with a401error. - Check image pull access. If using a private container registry, make sure the orchestrator (Docker) or cluster (Kubernetes) has pull credentials configured.
- Raise the timeout. If a request fails with
Terminal '<name>' timed out. It may still be starting. Please try again., raiseAIOHTTP_CLIENT_TIMEOUT_TERMINAL.
Authentication failures
- Confirm the key is set identically on both sides. Check for extra whitespace or newlines.
- Check the orchestrator logs for
401or403responses.
Workspace is reaped too quickly
Raise the idle timeout, see Idle cleanup, lifetime and scheduled resets.
Connection refused
- Docker: ensure
TERMINALS_DOCKER_NETWORKis set so containers can communicate by name. Without it, containers use published ports and theTERMINALS_DOCKER_HOSTaddress must be reachable. - Kubernetes: verify the orchestrator Service is accessible from the Open WebUI Pod. Run
kubectl get svc -n open-webuito confirm the service exists.
Further reading
- Multi-User Setup: comparison of isolation approaches
- Security best practices
- Configuration reference: all Open Terminal container settings
License
Terminals requires an Open WebUI Enterprise License for production use. See the Terminals repository for details.