📝 Allow to set the PUID and PGID using docker https://github.com/siyuan-note/siyuan/pull/12596

This commit is contained in:
Daniel 2024-09-28 11:36:46 +08:00
parent f0e0b98953
commit 214b566d3c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 18 additions and 16 deletions

View file

@ -179,8 +179,8 @@ The entry point is set when building the Docker image: `ENTRYPOINT ["/opt/siyuan
Use the following parameters when running the container with `docker run b3log/siyuan`:
- `--workspace`: Specifies the workspace folder path, mounted to the container via `-v` on the host
- `--accessAuthCode`: Specifies the access authorization code
* `--workspace`: Specifies the workspace folder path, mounted to the container via `-v` on the host
* `--accessAuthCode`: Specifies the access authorization code
More parameters can be found using `--help`. Heres an example of a startup command with the new environment variables:
@ -194,11 +194,11 @@ docker run -d \
--accessAuthCode=xxx
```
- `PUID`: Custom user ID (optional, defaults to `1000` if not provided)
- `PGID`: Custom group ID (optional, defaults to `1000` if not provided)
- `workspace_dir_host`: The workspace folder path on the host
- `workspace_dir_container`: The path of the workspace folder in the container, as specified in `--workspace`
- `accessAuthCode`: Access authorization code (please **be sure to modify**, otherwise anyone can access your data)
* `PUID`: Custom user ID (optional, defaults to `1000` if not provided)
* `PGID`: Custom group ID (optional, defaults to `1000` if not provided)
* `workspace_dir_host`: The workspace folder path on the host
* `workspace_dir_container`: The path of the workspace folder in the container, as specified in `--workspace`
* `accessAuthCode`: Access authorization code (please **be sure to modify**, otherwise anyone can access your data)
To simplify things, it is recommended to configure the workspace folder path to be consistent on the host and container, such as having both `workspace_dir_host` and `workspace_dir_container` configured as `/siyuan/workspace`. The corresponding startup command would be:
@ -235,8 +235,9 @@ services:
```
In this setup:
- `PUID` and `PGID` are set dynamically and passed to the container.
- If these variables are not provided, the default `1000` will be used.
* `PUID` and `PGID` are set dynamically and passed to the container
* If these variables are not provided, the default `1000` will be used
By specifying `PUID` and `PGID` in the environment, you avoid the need to explicitly set the `user` directive (`user: '1000:1000'`) in the compose file. The container will dynamically adjust the user and group based on these environment variables at startup.