Reputation: 19225
I'm trying to get my head around building Docker images with Google's Jib project and Jib Maven Plugin.
I don't understand how to specify the JRE version.
I understand I can customize in the plugin's config, something like:
<configuration>
<from>
<image>gcr.io/distroless/java</image>
</from>
</configuration>
but what does that mean in terms of the actual JRE version which will be used ? What if I want say specifically JRE 8u172 ?
The Jib project states this as a feature:
Reproducible - Rebuilding your container image with the same contents always generates the same image.
therefore I'm assuming there must be some way to lock down the JRE version?
Level: Advanced on Java and Maven, newbie on everything Docker.
Upvotes: 6
Views: 4125
Reputation: 377
Availability of 8u172 depends on whether the distributor has created a build image of that version.
java building version is not managed with docker image tags with gcr.io/distroless/java
.
Currently gcr.io/distroless/java:8
, it was 8u212 as below.
https://console.cloud.google.com/gcr/images/distroless/GLOBAL/java?gcrImageListsize=30
~ $ docker run -it --rm --entrypoint java gcr.io/distroless/java:8 -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1~deb9u1-b01)
OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)
~ $
If you want to specify to java build version, I suggest using AdroptOpenJDK.
e.g.
<configuration>
<from>
<image>adoptopenjdk/openjdk8:jdk8u172-b11</image>
</from>
</configuration>
If you can use 8u171, you can select openjdk.
<configuration>
<from>
<image>openjdk:8u171-jre</image>
</from>
</configuration>
Upvotes: 4
Reputation: 931
You probably want to use a base image with java preinstalled. every docker image contains tag(s), which are like versions. if you don't specify tag like you did above, then the latest is taken and that can lead to unexpected change of java version.
For example you can use opendjk
image with java version 8u212
by using openjdk:8u212-jre-stretch
. and in OpenJDK Docker Hub you can see the list of all available tags
Upvotes: 1