Which minor version would be pulled if we don't specify the Docker image version for OpenJDK?

1.1k views Asked by At

If I specify the following base image, which minor version of Java would be pulled?

FROM adoptopenjdk/openjdk11:alpine-jre

Similarly, which minor version would be pulled if I specify the following:

FROM adoptopenjdk/openjdk11-openj9:alpine-jre

Documentation for above images:

Or how can I identify it myself?

If I click on "alpine-jre" on the page to see the dockerfile (https://github.com/AdoptOpenJDK/openjdk-docker/blob/master/11/jre/alpine/Dockerfile.hotspot.releases.full), I see the java version as "jdk-11.0.11+9" but when I got to my container shell and check the version there, I see the version "11.0.9.1"

enter image description here

1

There are 1 answers

0
David Maze On BEST ANSWER

With a "floating" tag like this, it will be whichever the most recent version that's been packaged is.

It's important to note that docker build and docker run will just use a local image if you have one, so if the image you have locally uses Java 11.0.9 and there's a newer one on Docker Hub with 11.0.11, you'll use the slightly older version. There is a docker build --pull option that does docker pull on every FROM line before building, which will make sure you have the most recent base image.

Since you can docker run the base image directly, it should be straightforward to figure out what's inside of it

docker run --rm adoptopenjdk/openjdk11:alpine-jre \
  java -version