I am creating a dockerfile that runs a custom application that is tied to a specific version of Java.
I'm using a centos7 base image because that's what an article I was referring to was using and because I have to use something, so that's as good as any. I honestly don't care what userland I'm using. The point of this image is the software being hosted, the Linux distribution itself is just a means to an end - importantly, the JDK will not be used by other applications or users.
As stated, my application is tied to the specific version of Java that I am using - any update to the Java version will require a full regression test of the software with that specific version before it is released.
The article I was following started out with the relevant dockerfile JDK install parts looking like this:
FROM centos:centos7
RUN yum makecache \
&& yum update -y \
&& yum install -y \
java-1.8.0-openjdk-devel \
&& yum clean all
That's not specific enough, any time the images is build it will get a random version of Java, which is not what I want, I need a specific version of Java.
I changed the docker file to look like this:
FROM centos:centos7
RUN yum makecache \
&& yum update -y \
&& yum install -y \
java-1.8.0-openjdk-devel-1.8.0.65-3.b17.el7 \
&& yum clean all
And the docker image was building fine. That was in December.
This week, I needed to make a small change to a different part of the software and rebuild a new version of the image, but the image build now fails.
The build fails now because that specific version of the java package is no longer available (at least, I think that's what it's telling me):
Error: Package: 1:java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64 (base)
Requires: java-1.8.0-openjdk-headless = 1:1.8.0.65-3.b17.el7
Available: 1:java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64 (base)
java-1.8.0-openjdk-headless = 1:1.8.0.65-3.b17.el7
Installing: 1:java-1.8.0-openjdk-headless-1.8.0.71-2.b15.el7_2.x86_64 (updates)
java-1.8.0-openjdk-headless = 1:1.8.0.71-2.b15.el7_2
How can I rebuild my dockerfile so that I can always use a specific version of Java (in this example, I want the version of java to be 1.8.0 update 65)?
A negative answer is fine - if the various Linux packaging mechanisms in general don't want people to use their repositories like this, that's Ok - I can always package my own version of the JDK as a zip file and just unpack that somewhere inside the environment as part of the image build, but that's a bunch of hassle that I'd prefer not to have to do.
How do other people do this? Is there a different way of installing the JDK so that I can have a recent version of the OS distribution with latest updates (as defined by the base image in the FROM clause and the yum update) but install a specific version of the JDK?
Is there a Linux version more suited to this kind of requirement (I'm not wedded to CentOS, the userland Linux distribution is not particularly important to me)?