docs: clarify persistent container storage

Document all stateful container paths, explain upgrade behavior and UnRAID mappings, and correct the obsolete troubleshooting mount target.

Assisted-by: Codex:gpt-5
This commit is contained in:
localai-org-maint-bot
2026-07-29 12:04:38 +00:00
parent 8089b2bf09
commit 3c0bc0c2ad
2 changed files with 36 additions and 4 deletions

View File

@@ -191,16 +191,31 @@ The container exposes the following volumes:
| `/configuration` | Dynamic config files (api_keys.json, external_backends.json, runtime_settings.json) | `--localai-config-dir` | `$LOCALAI_CONFIG_DIR` |
| `/data` | Persistent data (collections, agent state, tasks, jobs) | `--data-path` | `$LOCALAI_DATA_PATH` |
To persist models and data, mount volumes:
{{% notice warning %}}
Container files that are not stored in a volume are lost when the container is
recreated during an image upgrade. Mount all four paths if you want to preserve
installed models, backends, settings, and application data.
{{% /notice %}}
The host paths can be anywhere on persistent storage, but the container paths
must be exactly `/models`, `/backends`, `/configuration`, and `/data`. In
UnRAID and other container-template UIs, create one path mapping for each row
in the table above.
To use bind mounts:
```bash
docker run -ti --name local-ai -p 8080:8080 \
-v $PWD/models:/models \
-v $PWD/backends:/backends \
-v $PWD/configuration:/configuration \
-v $PWD/data:/data \
localai/localai:latest
# Or with Podman:
podman run -ti --name local-ai -p 8080:8080 \
-v $PWD/models:/models \
-v $PWD/backends:/backends \
-v $PWD/configuration:/configuration \
-v $PWD/data:/data \
localai/localai:latest
```
@@ -209,16 +224,24 @@ Or use named volumes:
```bash
docker volume create localai-models
docker volume create localai-backends
docker volume create localai-configuration
docker volume create localai-data
docker run -ti --name local-ai -p 8080:8080 \
-v localai-models:/models \
-v localai-backends:/backends \
-v localai-configuration:/configuration \
-v localai-data:/data \
localai/localai:latest
# Or with Podman:
podman volume create localai-models
podman volume create localai-backends
podman volume create localai-configuration
podman volume create localai-data
podman run -ti --name local-ai -p 8080:8080 \
-v localai-models:/models \
-v localai-backends:/backends \
-v localai-configuration:/configuration \
-v localai-data:/data \
localai/localai:latest
```

View File

@@ -388,17 +388,26 @@ services:
retries: 3
```
### Models Not Persisted Between Restarts
### Models or Settings Not Persisted Between Upgrades
Mount a volume for your models directory:
Container-local files are discarded when an upgrade recreates the container.
Mount all of LocalAI's stateful paths:
```yaml
services:
local-ai:
volumes:
- ./models:/build/models:cached
- ./models:/models
- ./backends:/backends
- ./configuration:/configuration
- ./data:/data
```
The paths on the left can be any persistent host directories or named volumes.
The container paths on the right must match exactly. See
[Persistent Storage]({{% relref "getting-started/containers#persistent-storage" %}})
for Docker, Podman, and UnRAID guidance.
## Network and P2P Issues
### P2P Workers Not Discovered