Before we can build the Oracle JRE image, make sure you completed the Step 1: Preparing your Environment.
Oracle provides a variety of Docker images for deploying Oracle Java and Oracle WebLogic. These images build and extend an Oracle Linux 7 docker image.
Clone the Oracle Docker Repo
To get started let’s first go ahead and clone the Oracle Github repo using git. I will be doing this in my user’s home directory. This will take some time as it is rather quite large.
$ git clone https://github.com/oracle/docker-images.git
Cloning the repo will create a local directory named docker-images. Check out the various projects that Oracle is currently supporting on Docker by looking through the docker-images directory.
Download Oracle JRE 8
The Oracle Github repo only contains docker files and helper scripts for building the actual images – it does NOT contain the actual binaries. These need to be downloaded separately from oracle.com.
Before we can build the JRE docker image, we need to download Oracle JRE 8 from oracle.com. Guidance and directions for downloading Oracle JRE are located in the docker-images/OracleJava/README.md.
View the contents of this file and follow the instructions for downloading Oracle JRE 8 and building the image.
Once you’ve downloaded Oracle JRE 8, place it in docker-images/OracleJava/java-8 or docker-images/OracleJava/windows-java-8 depending on your OS.
Build Oracle JRE 8 Docker Image
Run the build.sh scripted located in the java-8 directory to build the Oracle JRE 8 docker image.
$ cd docker-images/OracleJava/java-8
You can verify the image was built by running ‘docker images’ :
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/serverjre 8 b18ec85a7cbe 3 minutes ago 382.2 MB
oraclelinux latest 27a5201e554e 3 weeks ago 225.1 MB
hello-world latest c54a2cc56cbb 6 months ago 1.848 kB
You can see here from the output above that I have 3 docker images. The hello-world image was created when I ran the docker hello-world container to verify my docker installation. The oracle/serverjre was explicitly created when I ran the build.sh script earlier. The oraclelinux image was implicitly created when I built the Oracle JRE image.
Yay, we built a docker image for Oracle JRE. We can now use this image any time we need to install Java for running Weblogic.
Let’s move on to Step 3: Building the WebLogic Docker Image