Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the java version in docker image or container? [closed]

In my spring boot microservice project, one of the microservice is upgraded to java 11 and it is causing some issue in my existing functionality. I want to change the version of java from 11 to 8 in that microservice. but I am unable to do it as its created as docker image automatically through jenkins.

In the Gradle file I have mentioned the java version as 1.8 but still somehow in the kubernetes cluster only for this particular service java is upgraded to 11.

confirmed the version of java by using following command in the server. "docker exec {container_id} java -version"

please suggest me how I can change the version of java in docker image or containers?

Is it possible to change the java version just by running linux command? or is it require to follow some other steps?

like image 872
Rakshith M Avatar asked Oct 19 '25 23:10

Rakshith M


1 Answers

@RakshithM yes, Jenkins must refer the Dockerfile to build docker container, if you find out then you can do it as suggested by @David. for you reference https://docs.docker.com/language/java/build-images/ , any container refer to the base image which has the basic environment on which our application runs which basically starts with FROM in docker file. eg:

FROM openjdk:16-alpine3.13

here our container is referring to the openjdk:16 image which is minimal linux environment with java 16 on the top of which other tools are included which is defined in dockerfile. so in your case if you find the Dockerfile then you can change it to the java version of your need.

like image 181
msucil Avatar answered Oct 21 '25 13:10

msucil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!