title: Docker run returns an exception: Application has been compiled by a more recent version of the Java Runtime
body: <p>I created a web application using Springboot and now I'm going to dockerize it and upload it into docker hub. So my <code>Dockerfile</code> is,</p>
  <pre><code>FROM openjdk:8
  
  EXPOSE 8080
  
  ADD target/spring-boot-web-0.0.1-SNAPSHOT.jar spring-boot-web-0.0.1-SNAPSHOT.jar
  
  ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;spring-boot-web-0.0.1-SNAPSHOT.jar&quot;]
  </code></pre>
  <p>After creating <code>.jar</code> inside my target I'm building docker image using the following command,</p>
  <pre><code>docker build -t kubernatesimage
  </code></pre>
  <p>It builds the docker image successfully and when I run the <code>docker images</code> I can see the created image. But before uploading it into docker hub I need to run and check so I'm executing,</p>
  <pre><code>docker run -it  -p 4000:80 kubernatesimage 
  </code></pre>
  <p>And this returns the following exception,</p>
  <blockquote>
  <p>Exception in thread &quot;main&quot; java.lang.UnsupportedClassVersionError: guru/springframework/SpringBootWebApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0</p>
  </blockquote>
  <p>According to @Nithin's answer in <a href="https://stackoverflow.com/questions/47457105/class-has-been-compiled-by-a-more-recent-version-of-the-java-environment">this</a> StackOverflow question, I found  this happens due to version missmatch and the java version codes,</p>
  <pre><code>49 = Java 5
  50 = Java 6
  51 = Java 7
  52 = Java 8
  53 = Java 9
  54 = Java 10
  55 = Java 11
  56 = Java 12
  57 = Java 13
  58 = Java 14
  </code></pre>
  <p>But still, I have no idea what do I need to perform to solve the issue. I mentioned openjdk:8 in my <code>Dockerfile</code> and I run <code>java -version</code> to get the local JDK version and it returned</p>
  <pre><code>java version &quot;1.8.0_271&quot;
  </code></pre>
  <p>So do I need to change java version in my local machine or change my <code>Dockerfile</code>?</p>