I am trying to build a Docker Container (using a Dockerfile) with a specific version of Java 8 on it. A lot of the examples target the latest release.
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update -y
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java8-installer
I have a need where i want to control the specific version of Java that my container is provisioned. Any hint on how to achieve this? For Example Java 8 update 31.
To install packages in a docker container, the packages should be defined in the Dockerfile. If you want to install packages in the Container, use the RUN statement followed by exact download command . You can update the Dockerfile with latest list of packages at anytime and build again to create new image out of it.
To install any packages, you first need to update the OS. Step 3: After you have updated the Docker Container, you can now install the Firefox and Vim packages inside it. You can now easily use these packages through the bash itself.
As most PPA packages pack the latest stable version, I would recommend installing Java manually from Oracle, just like in this answer.
You can do all the work in the script too, the steps are:
wget
,tar -xz
,update-alternatives
to set is as defaultIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With