pier92
pier92

Reputation: 397

Upgrade jdk version of Tomcat docker container to 1.8

i've a web application on windows running from eclipse, with xampp for apache and mysql. It use jdk v 1.8.

Now, i want to deploy in inside a docker tomcat container. I've created a container from tomcat official image... but i've saw that its jdk version is 1.7 ... so there are some error when i try to run web-app under container (from tomcat logs i see unsupported major.minor version 52.0 (unable to load class)

So.. how can i solve my problem?

Upvotes: 0

Views: 5185

Answers (1)

GauravJ
GauravJ

Reputation: 2272

There are almost all versions of tomcat version available with openjre 8. However if you want to use JDK for some reason OR you are using some version of tomcat which does not have jre 8 runtime OR you want to use oracle JDK then following are 2 ways to have jdk 8

  1. You create your own docker file and extend the tomcat docker image.
  2. You use docker commit functionality. Instead of running docker like docker run -it --rm -p 8888:8080 tomcat:8.0 run it as docker run -it --rm -p 8888:8080 tomcat:8.0 bash. This will display the bash shell. You can then install jdk8 using this link. Do docker commit and you would be able to use that image anywhere.

Option 1 is always preferable as you have greater control over the image.

Upvotes: 3

Related Questions