Skip to content

Commit bcc9ca5

Browse files
gsmetjmtd
andcommitted
Use JAVA_OPTS_APPEND to append options in Dockerfile
Per Jonathan Dowland: In the Red Hat OpenJDK container images, the Env JAVA_OPTS configuration parameter is supposed to override all JVM tuning options generated by the run script. The related parameter JAVA_OPTS_APPEND is used to add to the script-generated parameters. In image versions including :1.14 to :1.16, a bug prevented it from behaving as intended: JAVA_OPTS did not override all tuning parameters, only some of them. This was noticed in <quarkusio#35863> Version :1.17 and newer of the ubi8/openjdk-17 container image changes the behaviour of JAVA_OPTS to properly override all run script parameters. Switch to using JAVA_OPTS_APPEND instead of JAVA_OPTS. Take the opportunity to update to the latest base image version (:1.17). Note: The Fabric8 run-java script behaves differently: JAVA_OPTIONS appends, and neither JAVA_OPTS nor JAVA_OPTS_APPEND are supported. This commit does not touch Dockerfiles using the fabric8 run-java. Co-authored-by: Jonathan Dowland <[email protected]>
1 parent 1f9a417 commit bcc9ca5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-11-runtime

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:1.17
22

33
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
44

5-
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
6-
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
5+
# Append additional options to the java process, you can add -XshowSettings:vm to also display the heap size.
6+
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
77

88
# We make four distinct layers so if there are application changes the library layers can be re-used
99
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/

extensions/container-image/container-image-docker/deployment/src/test/resources/openjdk-17-runtime

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.17
33

44
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
55

6-
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
7-
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
6+
# Append additional options to the java process, you can add -XshowSettings:vm to also display the heap size.
7+
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
88

99
# We make four distinct layers so if there are application changes the library layers can be re-used
1010
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/

independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ USER 185
8888
{#if java.version == '11'}
8989
ENV AB_JOLOKIA_OFF=""
9090
{/if}
91-
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
91+
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
9292
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
9393

9494
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

0 commit comments

Comments
 (0)