Add runtime UID/GID adjustment to match host workspace owner

This commit is contained in:
2026-04-10 13:57:45 +02:00
parent 94b64db751
commit 7685facb37
5 changed files with 137 additions and 79 deletions
+19
View File
@@ -103,6 +103,25 @@ opencode
| `GIT_USER_NAME` | Git commit author name |
| `GIT_USER_EMAIL` | Git commit author email |
### User ID Mapping
The container runs as user `developer` (UID 1000 by default). If your host user has a different UID, file permission mismatches can occur on mounted volumes.
The entrypoint automatically detects the owner of `/workspace` and adjusts the container user's UID/GID to match. You can also set it explicitly:
| Variable | Description | Default |
|---|---|---|
| `USER_UID` | Container user UID | Auto-detect from `/workspace` owner |
| `USER_GID` | Container user GID | Auto-detect from `/workspace` owner |
```bash
docker run -it --rm \
-e USER_UID=$(id -u) \
-e USER_GID=$(id -g) \
-v ~/projects:/workspace \
joakimp/opencode-devbox:latest
```
## Data Storage and Persistence
Understanding what survives container restarts and what doesn't: