Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ENV NEXUS_HOME=${SONATYPE_DIR}/nexus \
NEXUS_CONTEXT='' \
SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work

# configure the user id to be used with
# volume storage.
ENV USERID=200

# install Oracle JRE
RUN mkdir -p /opt \
&& curl --fail --silent --location --retry 3 \
Expand Down Expand Up @@ -68,7 +72,7 @@ RUN sed \
-e '/^-XX:MaxDirectMemorySize/d' \
-i ${NEXUS_HOME}/bin/nexus.vmoptions

RUN useradd -r -u 200 -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus \
RUN useradd -r -u ${USERID} -m -c "nexus role account" -d ${NEXUS_DATA} -s /bin/false nexus \
&& mkdir -p ${NEXUS_DATA}/etc ${NEXUS_DATA}/log ${NEXUS_DATA}/tmp ${SONATYPE_WORK} \
&& ln -s ${NEXUS_DATA} ${SONATYPE_WORK}/nexus3 \
&& chown -R nexus:nexus ${NEXUS_DATA}
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ for additional information.
$ docker run -d -p 8081:8081 --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
```

A simpler solution is to use the environment USERID of the docker image which looks like this:

```
$ docker run -d -p 8081:8081 --env USERID=`id -u` --name nexus -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
```

The `id -u` will give back the user id number only. You can of course give the id literally.

### Build Args

The Dockerfile contains two build arguments (`NEXUS_VERSION` & `NEXUS_DOWNLOAD_URL`) that can be used to customize what
Expand Down