Skip to content

Commit 87aaee2

Browse files
committed
Support configurable Docker Compose user IDs
- Add PUID/PGID overrides with 1000:1000 defaults - Preserve detected host UID/GID in installer-generated Compose files - Document bind-mount permissions and setup in repository and website docs
1 parent 4a6789d commit 87aaee2

4 files changed

Lines changed: 50 additions & 3 deletions

File tree

‎.env.example‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#
99
# Providers with no key set are skipped at startup.
1010

11+
# Docker Compose user (optional; defaults to 1000:1000).
12+
# For Linux bind mounts, use the directory owner's `id -u` and `id -g` values.
13+
# Pre-create the host directory and ensure this user can write to it.
14+
# PUID=1000
15+
# PGID=1000
16+
1117
# Alibaba — https://www.alibabacloud.com/help/en/model-studio/models
1218
DASHSCOPE_API_KEY=
1319

‎DOCKER.md‎

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ docker run --rm -v ~/.llms:/home/llms/.llms \
224224

225225
```bash
226226
cp .env.example .env # then fill in your keys
227+
mkdir -p ~/.llms # create the bind-mount directory before starting Docker
227228
docker compose up -d
228229
docker compose logs -f
229230
docker compose down
@@ -232,6 +233,21 @@ docker compose down
232233
The bundled `docker-compose.yml` uses `env_file: .env`, so it picks up every key
233234
in that file without needing an entry per provider.
234235

236+
Both Compose files run as `${PUID:-1000}:${PGID:-1000}`. For a Linux bind mount,
237+
set `PUID` and `PGID` in `.env` to the numeric IDs of the host account that owns
238+
the data directory (find them with `id -u` and `id -g`):
239+
240+
```dotenv
241+
PUID=1000
242+
PGID=1000
243+
```
244+
245+
Replace these example values with your IDs before starting Compose. The selected
246+
user must have write access to the mounted directory; setting these variables
247+
does not change its ownership. `docker-compose.local.yml` uses a named volume by
248+
default, initialized for UID/GID 1000:1000; keep the defaults for that volume
249+
unless its permissions have been prepared for another user.
250+
235251
### Available tags
236252

237253
Published to GitHub Container Registry and Docker Hub on every push to `main`
@@ -428,9 +444,30 @@ The installer prints the right command for your platform. On macOS you need
428444
Docker Desktop actually launched, not just installed.
429445

430446
**Permission denied writing to `~/.llms` (Linux)**
431-
The image runs as UID 1000. If your UID is different, the installer detects it
432-
and adds `--user $(id -u):$(id -g)` — stored as `LLMS_DOCKER_USER_ARGS` in
433-
`~/.llms/config`. If you're running Docker by hand, add that flag yourself.
447+
The image runs as the non-root `llms` user (UID/GID 1000:1000). Bind mounts use
448+
the host directory's ownership and permissions, replacing those set in the
449+
image. If the host directory doesn't exist, Docker may create it as root.
450+
451+
For Compose, pre-create the directory and set `PUID`/`PGID` in `.env` to its
452+
owner's IDs as described above. After changing them, run `docker compose up -d`
453+
to recreate the container. For direct `docker run` use, add
454+
`--user "$(id -u):$(id -g)"` when mounting a directory owned by your account.
455+
The installer configures this automatically on Linux via
456+
`LLMS_DOCKER_USER_ARGS` in `~/.llms/config`.
457+
458+
If a dedicated data directory was already created as root, stop the service
459+
and correct its ownership and owner permissions. For the default Compose user:
460+
461+
```bash
462+
docker compose down
463+
sudo chown -R 1000:1000 ~/.llms
464+
sudo chmod -R u+rwX ~/.llms
465+
docker compose up -d
466+
```
467+
468+
Use your configured `PUID:PGID` and actual data directory if they differ. For
469+
rootless Docker, user namespace remapping, or SELinux, also check the host's
470+
mount permissions and labeling requirements.
434471

435472
**Voice input isn't working**
436473
Check which mode the extension picked:

‎docker-compose.local.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
dockerfile: Dockerfile
66
image: llms-py:latest
77
container_name: llms-py
8+
# When using a bind mount, set PUID/PGID in .env to its owner's IDs.
9+
user: "${PUID:-1000}:${PGID:-1000}"
810
ports:
911
- "127.0.0.1:8000:8000"
1012
env_file:

‎docker-compose.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ services:
22
llms:
33
image: ghcr.io/servicestack/llms:latest
44
container_name: llms-py
5+
# For bind mounts, set PUID/PGID in .env to the host directory owner's IDs.
6+
user: "${PUID:-1000}:${PGID:-1000}"
57
ports:
68
# Only reachable from this machine. Use "8000:8000" to expose it on your LAN.
79
- "127.0.0.1:8000:8000"

0 commit comments

Comments
 (0)