📝 Allow to set the PUID and PGID using docker https://github.com/siyuan-note/siyuan/pull/12596
This commit is contained in:
parent
f0e0b98953
commit
214b566d3c
2 changed files with 18 additions and 16 deletions
19
README.md
19
README.md
|
@ -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`. Here’s 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.
|
||||
|
||||
|
|
|
@ -178,9 +178,9 @@
|
|||
|
||||
#### 启动入口
|
||||
|
||||
入口点在构建 Docker 镜像时设置: `ENTRYPOINT ["/opt/siyuan/entrypoint.sh"]`。该脚本允许更改将在容器内运行的用户的 `PUID` 和 `PGID`。这对于解决从主机挂载目录时的权限问题尤为重要。`PUID` 和 `PGID` 可以作为环境变量传递,这样在访问主机挂载的目录时就能更容易地确保正确的权限。
|
||||
入口点在构建 Docker 镜像时设置:`ENTRYPOINT ["/opt/siyuan/entrypoint.sh"]`。该脚本允许更改将在容器内运行的用户的 `PUID` 和 `PGID`。这对于解决从主机挂载目录时的权限问题尤为重要。`PUID` 和 `PGID` 可以作为环境变量传递,这样在访问主机挂载的目录时就能更容易地确保正确的权限。
|
||||
|
||||
使用 `docker run b3log/siyuan` 运行容器时,请使用以下参数:
|
||||
使用 `docker run b3log/siyuan` 运行容器时,请带入以下参数:
|
||||
|
||||
* `--workspace`:指定工作空间文件夹路径,在宿主机上通过 `-v` 挂载到容器中
|
||||
* `--accessAuthCode`:指定访问授权码
|
||||
|
@ -197,8 +197,8 @@ docker run -d \
|
|||
--accessAuthCode=xxx
|
||||
```
|
||||
|
||||
* `PUID`: 自定义用户 ID(可选,如果未提供,默认为 `1000)
|
||||
* `PGID`: 自定义组 ID(可选,如果未提供,默认为 `1000)
|
||||
* `PUID`: 自定义用户 ID(可选,如果未提供,默认为 `1000`)
|
||||
* `PGID`: 自定义组 ID(可选,如果未提供,默认为 `1000`)
|
||||
* `workspace_dir_host`:宿主机上的工作空间文件夹路径
|
||||
* `workspace_dir_container`:容器内工作空间文件夹路径,和后面 `--workspace` 指定成一样的
|
||||
* `accessAuthCode`:访问授权码,请**务必修改**,否则任何人都可以读写你的数据
|
||||
|
@ -215,7 +215,7 @@ docker run -d \
|
|||
--accessAuthCode=xxx
|
||||
```
|
||||
|
||||
使用 Docker Compose 部署请参考下面的示例:
|
||||
#### Docker Compose
|
||||
|
||||
对于使用 Docker Compose 运行思源的用户,可以通过环境变量 `PUID` 和 `PGID` 来自定义用户和组的 ID。下面是一个 Docker Compose 配置示例:
|
||||
|
||||
|
@ -238,8 +238,9 @@ services:
|
|||
```
|
||||
|
||||
在此设置中:
|
||||
- PUID “和 ”PGID "是动态设置并传递给容器的。
|
||||
- 如果没有提供这些变量,将使用默认的 `1000`。
|
||||
|
||||
* PUID “和 ”PGID "是动态设置并传递给容器的
|
||||
* 如果没有提供这些变量,将使用默认的 `1000`
|
||||
|
||||
在环境中指定 `PUID` 和 `PGID` 后,就无需在组成文件中明确设置 `user` 指令(`user: '1000:1000'`)。容器将在启动时根据这些环境变量动态调整用户和组。
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue