-2

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

Popeye
  • 1,548
  • 3
  • 25
  • 39
  • 2
    You basically have to go to the tags page and compare digests. Looks like 11.0.14 for the first one, 11.0.15 for the second. Or you can run the image and see. – jonrsharpe Apr 25 '22 at 07:52
  • Note that if you already pulled the image earlier just starting another container with that image won't pull the latest version, so you might see an older locally cached copy. Try `docker pull` to get the latest one. – Joachim Sauer Apr 25 '22 at 08:09
  • @jonrsharpe Thanks for your comment. Can you please see my update in the question? Also, can you please tell me how you reached to 11.0.14? – Popeye Apr 25 '22 at 08:09
  • I filtered the tags by alpine-jre and looked at the more specific tags with the same digest. – jonrsharpe Apr 25 '22 at 08:11

1 Answers1

1

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
David Maze
  • 130,717
  • 29
  • 175
  • 215