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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ VOLUME ${NEXUS_DATA}
EXPOSE 8081
USER nexus

ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
ENV INSTALL4J_ADD_VM_PARAMS="-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"

CMD ["/opt/sonatype/nexus/bin/nexus", "run"]
2 changes: 1 addition & 1 deletion Dockerfile.alpine.java21
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ VOLUME ${NEXUS_DATA}
EXPOSE 8081
USER nexus

ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
ENV INSTALL4J_ADD_VM_PARAMS="-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"

CMD ["/opt/sonatype/nexus/bin/nexus", "run"]
2 changes: 1 addition & 1 deletion Dockerfile.java21
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ VOLUME ${NEXUS_DATA}
EXPOSE 8081
USER nexus

ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs -Dfile.encoding=UTF-8"
ENV INSTALL4J_ADD_VM_PARAMS="-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs -Dfile.encoding=UTF-8"

CMD ["/opt/sonatype/nexus/bin/nexus", "run"]
2 changes: 1 addition & 1 deletion Dockerfile.rh.ubi.java21
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ VOLUME ${NEXUS_DATA}
EXPOSE 8081
USER nexus

ENV INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"
ENV INSTALL4J_ADD_VM_PARAMS="-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs"

ENTRYPOINT ["/uid_entrypoint.sh"]
CMD ["/opt/sonatype/nexus/bin/nexus", "run"]
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,26 @@ process, which runs as UID 200.

* There is an environment variable that is being used to pass JVM arguments to the startup script

* `INSTALL4J_ADD_VM_PARAMS`, passed to the Install4J startup script. Defaults to `-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs`.
* `INSTALL4J_ADD_VM_PARAMS`, passed to the Install4J startup script. Defaults to `-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs`.

This can be adjusted at runtime:

```
$ docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=/some-other-dir" sonatype/nexus3
```

**Java Memory Configuration Parameters:**

The example above demonstrates configuring Java memory parameters. Each parameter controls a specific aspect of memory allocation:

- `-Xms2703m`: Sets the initial heap size to 2703 MB
- `-Xmx2703m`: Sets the maximum heap size to 2703 MB
- `-XX:MaxDirectMemorySize=2703m`: Sets the maximum direct memory size to 2703 MB

These values should be adjusted based on your [memory requirements](https://help.sonatype.com/display/NXRM3/System+Requirements#SystemRequirements-MemoryRequirements). Setting `-Xms` and `-Xmx` to the same value prevents heap resizing and provides more predictable performance.

Of particular note, `-Djava.util.prefs.userRoot=/some-other-dir` can be set to a persistent path, which will maintain
the installed Sonatype Nexus Repository License if the container is restarted.

Be sure to check the [memory requirements](https://help.sonatype.com/display/NXRM3/System+Requirements#SystemRequirements-MemoryRequirements) when deciding how much heap and direct memory to allocate.

* Another environment variable can be used to control the Nexus Context Path

Expand Down