2

I used the official docker image for els (elasticsearch:6.6.1), and I get the following error, when I run the image:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

from searching online, there is problem with the JAVA, its using, and JAVA 8 is recommended.

I tried to make dockerfile that takes els:6.6.1 image, and install java8 on it:

FROM elasticsearch:6.6.1
RUN yum install -y  java-1.8.0-openjdk-devel
RUN export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64
RUN export PATH=$PATH:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/bin/

When I run it, I don't see JAVA_HOME env changing to the path I gave, and I still get the above error.

Do you know why?

Yagel
  • 1,184
  • 2
  • 18
  • 41

1 Answers1

3

Set environment variables by using ENV instead of RUN export.

FROM elasticsearch:6.6.1
RUN yum install -y java-1.8.0-openjdk-devel
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64

You can see more explanation by VonC docker ENV vs RUN export.

Corey
  • 1,217
  • 3
  • 22
  • 39