Showing posts with label Dockerfile Basics. Show all posts
Showing posts with label Dockerfile Basics. Show all posts

Monday 11 December 2023

Docker File for Java Container

Hi All,

Today I'm sharing my learning on how to write a sample DockerFile for a Java Container.

Pre-Requisite:
1. Docker to be installed
2. Decide a existing docker image to which you want to work upon: mostly as OS image on which we will work upon.
3. Download Oracle JDK on your local machine: you will need it upload the JDK to the container.
 

FROM container-registry.oracle.com/os/oraclelinux:8
COPY jdk-21_linux-aarch64_bin.tar.gz /home/
COPY target/docker-ex.jar /home/
RUN tar zxvf /home/jdk-21_linux-aarch64_bin.tar.gz
ENV JAVA_HOME /jdk-21.0.1
ENV PATH $JAVA_HOME/bin:$PATH;
ENTRYPOINT [ "java","-jar", "/home/docker-ex.jar" ]
#ENTRYPOINT java -jar /home/docker-ex.jar

Breakdown of the file.

FROM : Here we can either pass the Image ID or Image Name
COPY : JDK & jar to the docker image.
RUN: Execute the unzip command to JDK installation path.
ENV: Set JAVA_HOME and Updated Path of the image.
ENTRYPOINT: start point of image.

A Guide to Installing Oracle HR Schema on an Existing Docker Container

  Hi Reader, Today I want to share my learning on how to install Oracle HR schema on a existing docker container. Step 1: Download the verif...