This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-05 09:53:33 +09:00
1 parent 7c166fef2a
commit 21b32b6c59
4 files changed
+28 -2

No files matched your search

+2
View File
@@ -13,6 +13,8 @@ FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV TERMINALS_DATABASE_URL=sqlite+aiosqlite:////app/data/terminals.db
ENV TERMINALS_DOCKER_DATA_DIR=/app/data/terminals
WORKDIR /app
+15 -2
View File
@@ -21,13 +21,25 @@ The fastest way to get running is with Docker. Terminals will manage sibling con
```bash
docker run -p 3000:3000 \
-e TERMINALS_DOCKER_HOST=host.docker.internal \
-e TERMINALS_DOCKER_HOST_DATA_DIR="$(pwd)/data/terminals" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/data:/app/data \
-v "$(pwd)/data:/app/data" \
ghcr.io/open-webui/terminals:latest
```
**Prerequisites:** Docker running on the host.
The image stores SQLite at `/app/data/terminals.db` and accesses workspaces at
`/app/data/terminals`. Set the optional `TERMINALS_DOCKER_HOST_DATA_DIR` only when
the Docker daemon sees those workspaces at a different absolute path, as above.
Both paths must refer to the same bind-mounted directory so provisioning and
file resets access the same files. Leave it unset when running directly on the
Docker host or when host and container paths match.
When upgrading an existing deployment, back up and move its database and
workspaces from their previous effective paths before switching to this layout.
Changing these settings does not migrate existing files or container mounts.
### Kubernetes Operator (recommended for clusters)
For Kubernetes deployments, the operator manages `Terminal` custom resources automatically, handling pod creation, storage, and cleanup through CRDs.
@@ -243,7 +255,8 @@ All settings are configured through environment variables prefixed with `TERMINA
| `TERMINALS_DOCKER_HOST` | `127.0.0.1` | Host/IP that the orchestrator uses to reach published terminal container ports |
| `TERMINALS_DOCKER_NETWORK` | | Docker network for terminal containers. Use a comma-separated list to shard terminals across multiple Docker bridge networks. |
| `TERMINALS_DOCKER_MOUNTS` | | JSON array of extra bind mounts with `source`, `target`, and optional `readOnly` |
| `TERMINALS_DOCKER_DATA_DIR` | `data/terminals` | Host directory for per-user `/home/user` bind mounts |
| `TERMINALS_DOCKER_DATA_DIR` | `data/terminals` (`/app/data/terminals` in the image) | Workspace directory accessible to the orchestrator, including file resets |
| `TERMINALS_DOCKER_HOST_DATA_DIR` | | Optional absolute Docker-host path to the same workspace directory. Unset uses `TERMINALS_DOCKER_DATA_DIR`. |
### Kubernetes-only settings
+3
View File
@@ -86,6 +86,9 @@ class DockerBackend(Backend):
context_id = normalize_context_id(context_id)
instance_name = self._container_name(policy_id, user_id, context_id)
host_data_dir = str(self._home_dir(user_id, context_id).resolve())
if settings.docker_host_data_dir:
relative_home = self._home_dir(user_id, context_id).relative_to(settings.docker_data_dir)
host_data_dir = str(Path(settings.docker_host_data_dir) / relative_home)
s = spec or {}
image = s.get("image", settings.image)
+8
View File
@@ -36,6 +36,14 @@ class Settings(BaseSettings):
default=f"{_DEFAULT_DATA_DIR}/terminals",
validation_alias=AliasChoices("TERMINALS_DOCKER_DATA_DIR", "TERMINALS_DATA_DIR"),
)
docker_host_data_dir: str = "" # optional Docker-host path for docker_data_dir
@field_validator("docker_host_data_dir")
@classmethod
def _validate_docker_host_data_dir(cls, value: str) -> str:
if value and not Path(value).is_absolute():
raise ValueError("TERMINALS_DOCKER_HOST_DATA_DIR must be absolute")
return value
port: int = 3000
host: str = "0.0.0.0"