skip to Main Content

I want to crate docker image with java 17 and maven. My idea was to use openjdk image with java 17 but I see that opendjk is deprecated.

  1. What does it mean that is deprecated? It will work but without update?
  2. What image can I use for it? is there any one ready with java 17 and maven ?
  3. Can I use it for comercial purposes?

2

Answers


  1. you can use this Dockerfile for java 17

    FROM openjdk:17-jdk-slim AS build

    COPY pom.xml mvnw ./
    COPY .mvn .mvn
    RUN ./mvnw dependency:resolve

    COPY src src
    RUN ./mvnw package

    FROM openjdk:17-jdk-slim
    WORKDIR demo
    COPY –from=build target/*.jar demo.jar
    ENTRYPOINT ["java", "-jar", "demo.jar"]

    Login or Signup to reply.
  2. Here’s a good article:

    https://developers.redhat.com/articles/2022/09/16/updating-docker-hubs-openjdk-image

    For many years, the official Docker Hub image builders took OpenJDK
    Java SE update binaries from Eclipse Adoptium and other locations to
    build their own image. But in July 2022, the Docker Hub image builders
    announced the deprecation of this popular image.

    Now, Docker asks users to obtain their builds of OpenJDK, either from
    a commercial Java vendor or directly from the Adoptium project. There
    will be no further updates to the existing OpenJDK image, so users
    risk falling behind with functional and security updates to their Java
    SE usage unless they move to an alternate provider. I believe the
    official Eclipse Temurin image maintained by the Adoptium project is
    the obvious choice for a replacement image.

    In other words, the only thing that’s "deprecated" is the prebuilt Docker image. Not OpenJDK, and certainly not Java 17.

    It simply means that you’re responsible for adding the JDK of your choice to whatever Docker image you decide to use.

    Another alternative – which the same link goes on to suggest – is getting an image from the Adoptium project:

    Adoptium is a project dedicated to building, testing, and distributing
    up-to-date and ready-to-use OpenJDK binaries under an open source
    license. Adoptium calls their builds of OpenJDK, Temurin. They are
    available across a broad range of processors and operating systems.
    These Temurin binaries have over half a billion downloads and earned
    the trust of enterprise production environments worldwide. A
    vendor-independent working group based at the Eclipse software
    foundation leads Adoptium.

    The Adoptium community provides binaries built directly from OpenJDK
    source code. These Temurin binaries are available as direct downloads,
    installers, or container images and are faithful representations of
    the OpenJDK update source built under controlled conditions.

    The official Docker Hub Temurin images contain the latest releases of
    the OpenJDK updates for several Java SE versions, thoroughly tested
    with various applications. The images work as direct drop-in
    replacements for the OpenJDK images. Some OpenJDK images already
    contain Temurin binaries.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search