Skip to content

Commit 0ac4ac5

Browse files
committed
chore: configure data volume
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 0725b6f commit 0ac4ac5

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,12 @@ RUN --mount=from=builder,src=/build/,dst=/mnt/build \
384384
if [ -f /mnt/build/libopusshim.so ]; then cp /mnt/build/libopusshim.so ./; fi
385385

386386
# Make sure the models directory exists
387-
RUN mkdir -p /models /backends
387+
RUN mkdir -p /models /backends /data
388388

389389
# Define the health check command
390390
HEALTHCHECK --interval=1m --timeout=10m --retries=10 \
391391
CMD curl -f ${HEALTHCHECK_ENDPOINT} || exit 1
392392

393-
VOLUME /models /backends /configuration
393+
VOLUME /models /backends /configuration /data
394394
EXPOSE 8080
395395
ENTRYPOINT [ "/entrypoint.sh" ]

docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ services:
3131
volumes:
3232
- models:/models
3333
- images:/tmp/generated/images/
34+
- data:/data
3435
command:
3536
# Here we can specify a list of models to run (see quickstart https://localai.io/basics/getting_started/#running-models )
3637
# or an URL pointing to a YAML configuration file, for example:
@@ -73,4 +74,5 @@ services:
7374
volumes:
7475
models:
7576
images:
77+
data:
7678
# postgres_data:

docs/content/installation/containers.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,29 +212,44 @@ services:
212212

213213
## Persistent Storage
214214

215-
To persist models and configurations, mount a volume:
215+
The container exposes the following volumes:
216+
217+
| Volume | Description | CLI Flag | Environment Variable |
218+
|--------|-------------|----------|----------------------|
219+
| `/models` | Model files used for inferencing | `--models-path` | `$LOCALAI_MODELS_PATH` |
220+
| `/backends` | Custom backends for inferencing | `--backends-path` | `$LOCALAI_BACKENDS_PATH` |
221+
| `/configuration` | Dynamic config files (api_keys.json, external_backends.json, runtime_settings.json) | `--localai-config-dir` | `$LOCALAI_CONFIG_DIR` |
222+
| `/data` | Persistent data (collections, agent state, tasks, jobs) | `--data-path` | `$LOCALAI_DATA_PATH` |
223+
224+
To persist models and data, mount volumes:
216225

217226
```bash
218227
docker run -ti --name local-ai -p 8080:8080 \
219228
-v $PWD/models:/models \
229+
-v $PWD/data:/data \
220230
localai/localai:latest-aio-cpu
221231
# Or with Podman:
222232
podman run -ti --name local-ai -p 8080:8080 \
223233
-v $PWD/models:/models \
234+
-v $PWD/data:/data \
224235
localai/localai:latest-aio-cpu
225236
```
226237

227-
Or use a named volume:
238+
Or use named volumes:
228239

229240
```bash
230241
docker volume create localai-models
242+
docker volume create localai-data
231243
docker run -ti --name local-ai -p 8080:8080 \
232244
-v localai-models:/models \
245+
-v localai-data:/data \
233246
localai/localai:latest-aio-cpu
234247
# Or with Podman:
235248
podman volume create localai-models
249+
podman volume create localai-data
236250
podman run -ti --name local-ai -p 8080:8080 \
237251
-v localai-models:/models \
252+
-v localai-data:/data \
238253
localai/localai:latest-aio-cpu
239254
```
240255

0 commit comments

Comments
 (0)