Home > OS >  show java version on docker logstash
show java version on docker logstash

Time:10-20

Context: There is a need to bump the Java version that logstash image is running on. I was hoping that bumping the logstash image version would give the needed java version bump (desired outcome is bump to java 11.0.12 or greater), but I don't know how to even check what version of java is running.

Currently using the docker image docker.elastic.co/logstash/logstash:7.14.2, but how to check java version?

Following https://github.com/elastic/logstash/issues/11907, I tried this:

docker run --rm -it docker.elastic.co/logstash/logstash:7.14.2 java -version, but this is the result:

/usr/local/bin/docker-entrypoint: line 14: exec: java: not found

however, running docker run --rm -it docker.elastic.co/logstash/logstash:7.9.0 java -version gives the following output:

Status: Downloaded newer image for docker.elastic.co/logstash/logstash:7.9.0
openjdk version "11.0.8" 2020-07-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.8 10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.8 10-LTS, mixed mode, sharing)

I don't understand why a logstash docker version 7.9.0 recognizes java -version command, but not 7.14.2. I tried 7.10.0 and 7.11.0 etc., seems to be the same and cannot check. How can I check java version for logstash version beyond 7.9.x?

CodePudding user response:

Since version 7.10 Logstash uses a bundled java, this is why you can run the java command when using the 7.9 docker images and not when using version above that.

Until version 7.9, the docker image installed java using yum which makes the java binary available globally in the container because its location is exported in the PATH environment variable.

From version 7.10 java is not installed through yum as the bundled java is used, so the java binary is not available in the PATH environment variable.

You will need to run the full path to the java binary, which should be /usr/share/logstash/jdk/bin.

  • Related