Skip to content

RDoc-3381 Cannot change UID:GID of container user #2058

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,30 @@ E.g. `chown -R 999:999 $TARGET_DATA_DIR`

## Customizing the RavenDB data directory owner user UID/GID

In order to use a custom UID/GID for the `ravendb` user please build the Ubuntu container image yourself providing desired **UID** and
**GID** values, using the following arguments upon build:
**UID**: `--build-arg "RAVEN_USER_ID=999"`
**GID**: `--build-arg "RAVEN_GROUP_ID=999"`
E.g., `docker build --build-arg "RAVEN_USER_ID=999" --build-arg "RAVEN_GROUP_ID=999" <...>`
To customize the **UID** and **GID** of the `ravendb` user (e.g. to match your host user or for volume permissions), you can build your own image using the official `ravendb` base image.

{CODE-BLOCK:csharp}
FROM ravendb/ravendb:7.0-ubuntu-latest

ARG USER_ID=1000
ARG GROUP_ID=1000

USER root

RUN groupmod -g "${GROUP_ID}" "ravendb" && \
usermod -u "${USER_ID}" -g "${GROUP_ID}" ravendb && \
chown root:${USER_ID} /etc/ravendb/settings.json && \
find / -xdev -uid 0 -gid 999 -exec chown "root:${GROUP_ID}" {} +


USER ravendb
{CODE-BLOCK/}

### Build Instructions

1. Save the above as `dockerfile`
2. Open a terminal in that directory
3. Build the custom image with your desired UID and GID: `docker build --build-arg USER_ID=YourUserID --build-arg GROUP_ID=YourGroupID -t image-name -f dockerfile`

## Migrate files and data

Expand Down
Loading