Home > Back-end >  Create Docker Image with Custom JDK
Create Docker Image with Custom JDK

Time:05-14

I'm attempting to create a Docker image for my custom JDK install. It's simply the Jetbrains Runtime with Hotswap agent added to it. I'm new to docker images and creating a source image like this seems to be extra difficult to find clear documentation.

So far, I have this in my Dockerfile and I don't really know where to go from here:

// Needs a base image, but I'm not sure what

RUN wget https://cache-redirector.jetbrains.com/intellij-jbr/jbr_dcevm-17_0_1-linux-x64-b164.8.tar.gz -O /tmp/jbr-17.0.1.tar.gz && \
    mkdir /usr/lib/jvm/jbr-17.0.1 && \
    tar -xzf /tmp/jbr-17.0.1.tar.gz -C /usr/lib/jvm/jbr-17.0.1

RUN mkdir /usr/lib/jvm/jbr-17.0.1/lib/hotswap && \
    wget https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar -O /usr/lib/jvm/jbr-17.0.1/lib/hotswap/hotswap-agent.jar

ENV JAVA_HOME /usr/lib/jvm/jbr-17.0.1
RUN export JAVA_HOME

I'd appreciate any guidance on how to make this into an image that I can use in a Docker.

Thanks in advance!

CodePudding user response:

Your Dockerfile /Containerfile has always to begin with: FROM. This indicates a base image as you already commented.

A base image is in most cases a minimalistic type of OS like: ubuntu, alpine, ubi from redhat etc. and it provides a filesystem, package manager etc. Thus it is possible to use commands like wget, mkdir, as you have in your file.

Your main application starts with CMD <yourexe "param1" "parama2" ...>

After defining you Dockerfile you can create the image file with docker build.

For Further information see: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

  • Related