Docker templates and docs say to use `JAVA_OPTS` but `run-java.sh` docs say `JAVA_OPTIONS`, and `JAVA_OPTS_APPEND` does not exist
See original GitHub issueDescribe the bug
We ran into a production issue where the JAVA_OPTS
variable was not being honored.
Some of our users have stringent vulnerability requirements so we cannot use the default Dockerfile image.
To get around this, we created a custom Dockerfile where we use a more recent base image and emulate the same functionality:
FROM registry.access.redhat.com/ubi9-minimal:9.0.0-1580
ARG RUN_JAVA_VERSION=1.3.8
ARG JAVA_PACKAGE=java-17-openjdk-headless
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
RUN microdnf install -y ${JAVA_PACKAGE} \
&& microdnf update -y \
&& microdnf clean all \
&& mkdir /deployments \
&& chown 185 /deployments \
&& chmod "g+rwX" /deployments \
&& chown 185:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
&& chown 185 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 build/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 build/quarkus-app/*.jar /deployments/
COPY --chown=185 build/quarkus-app/app/ /deployments/app/
COPY --chown=185 build/quarkus-app/quarkus/ /deployments/quarkus/
EXPOSE 8080 5005
USER 185
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
ENTRYPOINT ["/deployments/run-java.sh"]
The generated Docker template says this:
But in the run-java
repo, there doesn’t seem to be a JAVA_OPTS
or JAVA_OPTS_APPEND
:
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a
or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
java - Passing JAVA_OPTS to spring boot application through ...
The main problem with it is that with this approach you application won't receive the ... If you want customize the java opts...
Read more >Docker and JAVA_OPTS - Veracode
While adjusting some environment variables recently, I came across an odd issue with Docker, Spring Boot and JAVA_OPTS.
Read more >Question: Where to set JAVA and CATALINA OPTS #80 - GitHub
Hi, if have tried to configure the JAVA_OPTS via setenv.sh in /opt/bitnami/tomecat/bin but it seems that this changes are overwritten (i.e. ...
Read more >APM (java agent) - New Relic Explorers Hub
Hi! Is there a way to be the hostname of the server will be on the app_name on the newrelic.yml? Like $HOSTNAME?
Read more >Chapter 3. Configuring the JBoss EAP for OpenShift Image for ...
The recommended method is to use the OpenShift S2I process, together with application template parameters and environment variables. Important. Any ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, we need to check as we had several
run-java.sh
over the years… I need to check the one provided by the lastest UBI Java runtime image. The template is quite old, and the property name likely changed.Thank you!!