Use Java 8 in okteto development container

Hi,
I have an old codebase(whose some dependency I dont have source code) based on java 8 for ex modelmapper:2.3.X which does not have module suport.
When I tried okteto maven:3 image I noticed it is using OpenJDK 17 version.
Is there any way I can downgrade java version to 8 inside development container so that my springboot application will be up inside container.

Any help will be appreciated.

Thanks,
Prasanta

Hi Prasanta,

Yes, it’s possible! We don’t have a java8 image in the list of images we maintain, but with okteto, you can use any container images for your development environment.

In this case, there are two options:

  1. Find a public image Docker that has java8
  2. Build a Docker image with Java8 and push that image to a registry that you have access to (for example, DockeHub). This is the Dockerfile for the okteto\maven:3 image, in case it serves as inspiration.

Then use that image in your okteto.yaml file instead of ‘okteto\maven:3’:

....
dev:
  hello-world:
    image: <YOUR_IMAGE>
    command: bash
    sync:
      - .:/usr/src/app
    forward:
      - 5005:5005
    volumes:
      - /root/.m2
.....

HI @ramiro ,

It worked. Thank you. I am using maven’s java 8 public image.

Thanks,
Prasanta

1 Like

2 posts were split to a new topic: How to include my local bashrc on my development environment