title: How to define OpenJDK 8 in CentOS based Dockerfile?
body: <p>Assuming that there is a CentOS Dockerfile:</p>
  
  <pre><code>FROM centos
  </code></pre>
  
  <p>What is the right way of adding OpenJDK 8 for it ?</p>
  
  <p>I have tried to use similar approach as for Fedora <a href="https://github.com/projectatomic/docker-fedora-images/blob/master/java-openjdk-8/Dockerfile" rel="noreferrer">https://github.com/projectatomic/docker-fedora-images/blob/master/java-openjdk-8/Dockerfile</a></p>
  
  <p>But when I run the image java version is <em>"1.7.0_111"</em>, even though it is expected to be JDK 8:</p>
  
  <pre><code>docker run -i -t &lt;image&gt; /bin/bash
  
  [user@2fcc1e47c3cd projects]$ java -version
  
  java version "1.7.0_111"
  OpenJDK Runtime Environment (rhel-2.6.7.2.el7_2-x86_64 u111-b01)
  OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)
  </code></pre>
  
  <p>There are many sources which describe Oracle JDK installations, but I was not able to find any relevant instructions for OpenJDK</p>