question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Describe 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:

https://github.com/quarkusio/quarkus/blob/affcf54e6f2d202b8a40989718d0dc264736c72e/integration-tests/maven/src/test/resources-filtered/projects/codegen-config-factory/app/src/main/docker/Dockerfile.jvm#L26-L29

But in the run-java repo, there doesn’t seem to be a JAVA_OPTS or JAVA_OPTS_APPEND:

image

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:closed
  • Created 10 months ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
cescoffiercommented, Nov 28, 2022

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.

0reactions
GavinRay97commented, Nov 29, 2022

Thank you!!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found