Skip to content

Commit b5de270

Browse files
authored
Merge pull request #2058 from poissoncorp/RDoc-3381
RDoc-3381 Cannot change UID:GID of container user
2 parents d6c1c10 + 0b89002 commit b5de270

File tree

1 file changed

+24
-5
lines changed
  • Documentation/6.0/Raven.Documentation.Pages/migration/server

1 file changed

+24
-5
lines changed

Documentation/6.0/Raven.Documentation.Pages/migration/server/docker.markdown

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,30 @@ E.g. `chown -R 999:999 $TARGET_DATA_DIR`
5353

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

56-
In order to use a custom UID/GID for the `ravendb` user please build the Ubuntu container image yourself providing desired **UID** and
57-
**GID** values, using the following arguments upon build:
58-
**UID**: `--build-arg "RAVEN_USER_ID=999"`
59-
**GID**: `--build-arg "RAVEN_GROUP_ID=999"`
60-
E.g., `docker build --build-arg "RAVEN_USER_ID=999" --build-arg "RAVEN_GROUP_ID=999" <...>`
56+
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.
57+
58+
{CODE-BLOCK:csharp}
59+
FROM ravendb/ravendb:7.0-ubuntu-latest
60+
61+
ARG USER_ID=1000
62+
ARG GROUP_ID=1000
63+
64+
USER root
65+
66+
RUN groupmod -g "${GROUP_ID}" "ravendb" && \
67+
usermod -u "${USER_ID}" -g "${GROUP_ID}" ravendb && \
68+
chown root:${USER_ID} /etc/ravendb/settings.json && \
69+
find / -xdev -uid 0 -gid 999 -exec chown "root:${GROUP_ID}" {} +
70+
71+
72+
USER ravendb
73+
{CODE-BLOCK/}
74+
75+
### Build Instructions
76+
77+
1. Save the above as `dockerfile`
78+
2. Open a terminal in that directory
79+
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`
6180

6281
## Migrate files and data
6382

0 commit comments

Comments
 (0)