<p>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.</p>
<p>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.</p>
<p>confirmed the version of java by using following command in the server.
&quot;<strong>docker exec {container_id} java -version</strong>&quot;</p>
<p>please suggest me how I can change the version of java in docker image or containers?</p>
<p>Is it possible to change the java version just by running linux command? or is it require to follow some other steps?</p>

Rakshith M
<p>@RakshithM yes, Jenkins must refer the <code>Dockerfile</code> to build docker container, if you find out then you can do it as suggested by @David. for you reference <a href="https://docs.docker.com/language/java/build-images/" rel="nofollow noreferrer">https://docs.docker.com/language/java/build-images/</a> , any container refer to the base image which has the basic environment on which our application runs which basically starts with <code>FROM</code> in docker file.
eg:</p>
<pre><code>FROM openjdk:16-alpine3.13
</code></pre>
<p>here our container is referring to the <code>openjdk:16</code> image which is <code>minimal linux environment with java 16</code> on the top of which other tools are included which is defined in <code>dockerfile</code>. so in your case if you find the <code>Dockerfile</code> then you can change it to the java version of your need.</p>
