-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to set the PUID and PGID using docker #12596
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question, does it work just with docker (not compose)?
Dockerfile
Outdated
ENV RUN_IN_CONTAINER=true | ||
EXPOSE 6806 | ||
VOLUME /home/siyuan/workspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this will affect users who have specified the --workspace
parameter, such as the usage described in the README:
docker run -d -v workspace_dir_host:workspace_dir_container -p 6806:6806 b3log/siyuan --workspace=workspace_dir_container --accessAuthCode=xxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this will affect users who have specified the
--workspace
parameter, such as the usage described in the README:docker run -d -v workspace_dir_host:workspace_dir_container -p 6806:6806 b3log/siyuan --workspace=workspace_dir_container --accessAuthCode=xxx
That's a very valid point. I think I can safely remove this line though, I will test if it impacts the result.
Another question, does it work just with docker (not compose)?
Yes, customizing USER_ID
and GROUP_ID
is possible with just Docker, not only via Docker Compose. You can pass --build-arg
during the docker build
process to specify these values.
docker build --build-arg USER_ID=1005 --build-arg GROUP_ID=100 -t siyuan_note_image .
docker run -d --name siyuan_note siyuan_note_image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the ownership of the workspace should also change if the workspace is specified.
In addition, please modify the corresponding document example in README:
The above content should be adjusted so that users know how to use it. Thank you. |
While working on the Readme I realized the approach has an issue. It works only for developers who have a copy of the project and will build the image themselves, it does not work for someone using the pre-built image 🤔 I will have to adjust my approach. |
3f4970f
to
53c27f6
Compare
@88250 I've extracted the logic for user and group creation from the Dockerfile to an I've updated the english readme and tried to do the same for the chinese readme using DeepL. Can you check if the chinese one makes any sense? |
Great! I'll adjust the details of the Chinese README later. Thank you very much for your contribution! |
Feature
This solves the request #9707
Description of the Issue:
The current Dockerfile hardcodes the creation of a user and group with specific user IDs (UID) and group IDs (GID). This approach lead to two major problems:
Changes Made:
siyuan
user in case the provided GID exists already on the container