mirror of
https://github.com/open-webui/terminals.git
synced 2026-11-05 01:37:21 +00:00
[GH-ISSUE #55] Bug: Docker deployment conflates container-local and Docker-host paths for TERMINALS_DOCKER_DATA_DIR #25
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/terminals#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @i0ntempest on GitHub (Sep 1, 2026).
Original GitHub issue: https://github.com/open-webui/terminals/issues/55
Description
When the Terminals orchestrator runs inside Docker and manages sibling Open Terminal containers through
/var/run/docker.sock, it conflates two filesystem namespaces:TERMINALS_DOCKER_DATA_DIRis used in both namespaces, even though the same pathname is not necessarily valid in both. As a result, the documented/app/datavolume does not reliably back the spawned terminals'/home/userdirectories. The documented volume also does not reliably persist the orchestrator SQLite database.This causes policy loss after an orchestrator restart, followed by 404 responses for policy-prefixed Open WebUI requests.
Environment
ghcr.io/open-webui/terminals:v0.2.3docker runThis should also affect Docker Compose deployments because the documented Compose configuration uses the same
/app/datamount.Relevant documented configuration
The Docker documentation mounts:
The repository quick start similarly uses
-v "$(pwd)/data:/app/data". However, these mounts only make /app/data available inside the orchestrator container. They do not make /app/data refer to the same directory from the Docker daemon's host namespace.Documentation:
https://github.com/open-webui/docs/blob/main/docs/features/open-terminal/terminals/tab-deployment/Docker.md
https://github.com/open-webui/terminals/blob/main/README.md
Root cause: workspace path crosses filesystem namespaces
The Docker backend constructs a per-user path using
settings.docker_data_dir:It resolves that path inside the orchestrator container:
It then passes the resulting string directly to the Docker daemon as a bind
source:
Source:
https://github.com/open-webui/terminals/blob/main/terminals/backends/docker.py#L61-L92
For example, consider this deployment:
Inside the orchestrator:
But when the orchestrator asks the Docker daemon to create a sibling container
with:
the daemon interprets
/app/data/terminals/<user-id>on the Docker host. Itdoes not know that
/app/datainside the orchestrator maps to/host/terminals-data.On a Linux Docker host, this can create or use an unrelated host directory under
/app/data. With Docker Desktop, it may refer to a path inside the Docker VM.It does not refer to the volume mounted into the orchestrator.
The code also accesses this same path locally during reset:
Therefore
TERMINALS_DOCKER_DATA_DIRmust currently be valid both:One setting cannot correctly represent differently mapped host and container
paths.
Related issue: SQLite database path is not guaranteed to be
/app/dataThe default database path is derived from the installed Python package location:
Source:
https://github.com/open-webui/terminals/blob/main/terminals/config.py#L7-L34
The image uses
pip install .and runs the installedterminalsentry point.The package-relative default may therefore resolve to a path such as:
That location is outside the documented
/app/datavolume.The effective paths can be confirmed with:
If the database is outside
/app/data, policies and lifecycle configurationare written into the orchestrator container's writable layer and disappear when
a
--rmcontainer is restarted.Symptoms
After restarting the Terminals orchestrator:
terminals.db.Example:
The policy proxy explicitly returns 404 when its database lookup finds no
matching policy:
Editing and re-saving the terminal connection in Open WebUI temporarily fixes
the problem because Open WebUI performs a
PUTthat recreates the missingpolicy. The policy disappears again on the next orchestrator restart.
Steps to reproduce
Create a Docker network:
Start Terminals using the documented storage layout:
Configure an orchestrator connection and named policy in Open WebUI.
Activate it so that a user terminal is provisioned.
Inspect the spawned terminal:
Observe that the spawned container uses a source resembling:
This is interpreted on the Docker daemon host, not through the
terminals-data:/app/datamount attached to the orchestrator.Inspect the effective database path:
Stop and recreate the orchestrator.
Observe that policies are gone and
/p/<policy-id>/...requests return 404.Expected behavior
The documented volume configuration should persist:
/home/userworkspaces.A user should not need to mount a host directory at the exact same absolute path
inside the orchestrator container.
Restarting the orchestrator should not remove policies or make existing Open
WebUI terminal connections return 404.
Actual behavior
/app/data.though it were a Docker-host path.
/host/data:/app/datacannot work for sibling-container bind sources.configured volume.
Current workaround
Persist the database separately and mount the workspace directory at the same
absolute path in both namespaces:
The identical source and destination path are necessary only because the current
implementation passes one pathname through both filesystem namespaces.
Suggested fixes
Option 1: Separate host and container workspace paths
Add separate configuration values, for example:
Then calculate corresponding paths:
Use
local_home_dirfor orchestrator filesystem operations andhost_home_diras the Docker bind source:The two roots would contain the same relative user/context path but could have
different absolute prefixes.
Option 2: Use Docker named volumes
Create and manage a named Docker volume for each user/context instead of passing
host bind paths. Reset operations could operate through the Docker volume API or
a short-lived helper container.
This avoids host-path translation entirely and works naturally with Docker
Desktop and remote Docker daemons.
Database fix
The official Docker image should explicitly default its database to the
documented volume:
Alternatively, the documentation should explicitly require this setting rather
than implying that mounting
/app/datais sufficient.Additional storage-policy inconsistency
The Docker backend always bind-mounts
/home/user, regardless of whether anOpen WebUI policy is shown as
ephemeralorpersistent.The policy's
storagevalue only addsStorageOptto the container writablelayer. It does not control whether
/home/useris persisted.Consequently, selecting
ephemeraldoes not avoid this path problem and doesnot discard
/home/userwhen the terminal container is removed. If this isintentional, the UI/documentation should clarify that the persistent/ephemeral
selection has different semantics on Docker and Kubernetes.