This repo contains a basic Dockerfile
for Ubuntu with Oracle Java and a builder Dockerfile
including Gradle, git and wget.
Clone this repo and cd
to the repo folder.
git clone https://github.com/BWibo/oracle-java-docker.git && cd oracle-java-docker
Download Oracle JDK Linux tar.gz
from: https://www.oracle.com/de/java/technologies/javase-downloads.html
For JDK version 11.0.10 you will get jdk-11.0.10_linux-x64_bin.tar.gz
.
Copy this file to the repo root.
Build image:
docker build -t myrepo/oracle-jdk:jdk-11.0.10 --build-arg JAVA_VERSION=jdk-11.0.10
.
Test image:
$ docker run --rm myrepo/oracle-jdk:jdk-11.0.10 java -version
java version "11.0.10" 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
Arg | Default | Description |
---|---|---|
BASEIMAGE_TAG | 20.04 |
Tag of the ubuntu Docker image to use as base image |
JAVA_VERSION | jdk-11.0.11 |
Java version that is used. Name of the jdk folder inside the downloaded JDK *.tar.gz |
JAVA_FILENAME | ${JAVA_VERSION}_linux-x64_bin.tar.gz |
File name of the downloaded JDK *.tar.gz |
INSTALL_DIR | /usr/lib/jdk |
Install dir of the JDK inside the container. $JAVA_HOME will be set to $INSTALL_DIR/$JAVA_VERSION |
The builder Dockerfile is based on the Oracle-JDK Dockerfile
. To build the image follow the steps above, but use this to build the image:
docker build -t myrepo/oracle-jdk-builder:jdk-11.0.11 --build-arg JAVA_VERSION=jdk-11.0.11 -f oracle-java-builder.dockerfile .
Arg | Default | Description |
---|---|---|
JAVA_VERSION | jdk-11.0.11 |
Java version that is used. Name of the jdk folder inside the downloaded JDK *.tar.gz |
INSTALL_DIR | /usr/lib/jdk |
Install dir of the JDK inside the container. $JAVA_HOME will be set to $INSTALL_DIR/$JAVA_VERSION |
GRADLE_VERSION | 7.0.2 |
Gradle version that is used for the image |