Answers: <p>There is no official Oracle JDK implementation provided by Docker. Docker used to support their own <a href="https://hub.docker.com/_/java/" rel="nofollow noreferrer">Java library</a> on hub.docker.com, but they deprecated it in favor of the actual OpenJDK implementation since it was "OpenJDK-specific since it was first introduced". Their reasoning:</p>
  
  <blockquote>
    <p>As all of the major upstream Linux distributions are unwilling to redistribute Oracle Java in their own distribution channels, we have chosen to follow them. See references below on how each distribution does not distribute Oracle Java.</p>
  </blockquote>
  
  <p>So if you want to keep your Docker image as small as possible, consider using OpenJDK instead. There's an official <a href="https://hub.docker.com/_/openjdk/" rel="nofollow noreferrer">OpenJDK Dockerfile repository</a> or you can just use <code>docker pull openjdk</code>. The basic "easy to run" Dockerfile for OpenJDK 7 is as follows (taken from the website listed in the previous sentence):</p>
  
  <pre><code>FROM openjdk:7
  COPY . /usr/src/myapp
  WORKDIR /usr/src/myapp
  RUN javac Main.java
  CMD ["java", "Main"]
  </code></pre>
  
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:38:05.463Z
Answers: There is no official Oracle JDK? That seems somewhat incorrect, or at least phrased incorrectly.
Answers: Evgeny Zislis
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:59:47.490Z
Answers: @Evgeny I agree, I assume the intent is to say: "No official docker image including Oracle JDK from Oracle", maybe  just a "docker " missing between JDK and implementation...
Answers: Tensibai
Answers: CC BY-SA 3.0
Answers: 2017-03-08T19:59:44.210Z
Answers: Oops, yes I did mean to make that Docker specific. I have corrected my answer.
Answers: Peter G
Answers: CC BY-SA 3.0
Answers: 2017-03-08T10:55:33.710Z
Answers: 2017-03-08T19:14:15.703Z
Answers: 2017-03-08T19:14:15.703Z
Answers: Peter G
Answers: <p>As docker is not an operating system, no there's no JDK for docker.</p>
  
  <p>As I understand your question, it's that a full JDK is too large for your wishes, in this case you may try switching to just the JRE and include only necessary libraries.</p>
  
  <p>JDK is the acronym of Java Development Kit, JRE is the one for Java Runtime Engine. By "lazyness" due to the complexity to list every needed dependency no one strip down to the necessary libraries only, but that is the way to go if you wish to reduce the installed size to strict minimum.</p>
  
  <p>A more usable way could be strip off some of the installed things which are taking a lot of space:</p>
  
  <pre><code>/usr/lib/jvm/jdk1.8.0_101$ du -hs *
  776K    bin
  4.0K    COPYRIGHT
  5.7M    db
  208K    include
  4.9M    javafx-src.zip
  187M    jre
  133M    lib
  4.0K    LICENSE
  2.0M    man
  4.0K    README.html
  4.0K    release
  21M     src.zip
  108K    THIRDPARTYLICENSEREADME-JAVAFX.txt
  176K    THIRDPARTYLICENSEREADME.txt
  </code></pre>
  
  <p>There's two *src.zip which can be removed, they won't be of use, and as you can see the lib directory is half the size and within it you have a bunch of things you don't really need:</p>
  
  <pre><code>/usr/lib/jvm/jdk1.8.0_101$ du -hs lib/*
  120K    lib/amd64
  1.2M    lib/ant-javafx.jar
  18M     lib/ct.sym
  160K    lib/dt.jar
  20K     lib/ir.idl
  36K     lib/javafx-mx.jar
  400K    lib/jconsole.jar
  12K     lib/jexec
  60M     lib/missioncontrol
  4.0K    lib/orb.idl
  8.0K    lib/packager.jar
  2.4M    lib/sa-jdi.jar
  18M     lib/tools.jar
  34M     lib/visualvm
  </code></pre>
  
  <p>You can without problem remove missoncontrol on a server, I assume you can get rid of visualvm also, you'll have to check if you need something in this lib directory, but I can't tell without knowing your app..</p>
  
  <p>One thing you should do in your dockerfile while installing oracle jdk is to remove the downloaded <code>.tar.gz</code> file which is roughly the same size as the resulting directory as <code>.jar</code> files are already compressed, the tar.gz is just there to "package" them.</p>
  
  <p>You have to do all this in the same <code>RUN</code> command, chaining with <code>&amp;&amp;</code> to avoid adding layers where you won't remove size by removing files from previous layer.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-03-08T10:58:47.563Z
Answers: 2017-03-08T11:12:43.530Z
Answers: 2017-03-08T11:12:43.530Z
Answers: Tensibai
Answers: <p>No. Because you <a href="http://www.oracle.com/technetwork/java/javase/terms/license/index.html" rel="noreferrer">cannot distribute Oracle JDK or JRE, the license in effect doesn't allow distribution</a>. When distributed by a third party (embedded with your app) all the liability for it not working is on that party. This is why you will not find Oracle JDK/JRE on any of the public Docker registries, or in any Linux package repositories for that matter.</p>
  
  <p>You can create your own image, and install Oracle JDK or JRE using the <a href="https://launchpad.net/~webupd8team/+archive/ubuntu/java" rel="noreferrer">webupd8team/java</a> package for Ubuntu/Debian.</p>
  
  <p>And if you are using Alpine Linux <a href="https://developer.atlassian.com/blog/2015/08/minimal-java-docker-containers/" rel="noreferrer">this blog post</a> explains which dependencies are required, and <a href="https://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead">links to StackOverflow</a> for installation instructions.</p>
  
  <p><strong>Update</strong>: Oracle has an official Docker image on the <em>Docker Store</em> now. <a href="https://blogs.oracle.com/developers/official-docker-image-for-oracle-java-and-the-openjdk-roadmap-for-containers" rel="noreferrer">https://blogs.oracle.com/developers/official-docker-image-for-oracle-java-and-the-openjdk-roadmap-for-containers</a></p>
  
  <p>Link to <em>Docker Store</em> Oracle Java Image - <a href="https://store.docker.com/images/oracle-serverjre-8" rel="noreferrer">https://store.docker.com/images/oracle-serverjre-8</a></p>
  
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:40:14.533Z
Answers: https://hub.docker.com/r/anapsix/alpine-java/
Answers: 030
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:41:23.743Z
Answers: I wouldn't rely on it being available for long. As I wrote, the license from Oracle does not allow to publicly distribute it - only Oracle can legaly distribute their JDK or JRE. So basically, this repository is illegal and will most likely disappear.
Answers: Evgeny Zislis
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:43:44.447Z
Answers: What you **can** do, is use their `Dockerfile`s on GitHub to get your own Docker image with Java. For example https://github.com/anapsix/docker-alpine-java/blob/master/8/121b13/jdk/unlimited/Dockerfile
Answers: Evgeny Zislis
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:44:21.223Z
Answers: And once the docker image is created I am allowed to store it in our private docker registry?
Answers: 030
Answers: CC BY-SA 3.0
Answers: 2017-03-08T13:44:54.407Z
Answers: Yes. The license prohibits from publicly distributing the JDK/JRE in binary form.
Answers: Evgeny Zislis
Answers: CC BY-SA 4.0
Answers: 2018-09-07T15:00:16.387Z
Answers: Ok, but this does not explain why Oracle does not provide docker image for Oracle JDK 10. They should.
Answers: mpr
Answers: CC BY-SA 4.0
Answers: 2017-03-08T10:45:50.673Z
Answers: 2018-09-03T17:17:04.297Z
Answers: 2018-09-03T17:17:04.297Z
Answers: Evgeny Zislis
Body: <pre><code>REPOSITORY          TAG       IMAGE ID       CREATED             SIZE
  an-image            1         X              26 seconds ago      279 MB
  </code></pre>
  
  <p>when the docker image will be run, the following message is shown:</p>
  
  <pre><code>No java installations was detected.
  Please go to http://www.java.com/getjava/ and download
  </code></pre>
  
  <p>When Oracle JDK is deployed the docker image size is more than doubled!</p>
  
  <pre><code>REPOSITORY          TAG       IMAGE ID       CREATED             SIZE
  an-image            2         X              26 seconds ago      666 MB
  </code></pre>
  
  <p><strong>Discussion</strong></p>
  
  <p>When "Is there no Oracle JDK for docker" is googled only some links to docker image that contain docker are returned. When Oracle JDK is deployed in the docker image the size is more than doubled. I want to keep the docker images as small as possible, but the Oracle JDK seems to be larger than the image itself!</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there no Oracle JDK for docker?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-09-13T12:35:46.137Z
Comments: @peter feel free to jump in [chatops](https://chat.stackexchange.com/rooms/54506/chatops) if you want to discuss it :)
Comments: Tensibai
Tags: <docker><oracle-jdk>
Title: Is there no Oracle JDK for docker?
UserDisplayName: 030
ThreadText: # Is there no Oracle JDK for docker?
  
  (Asked by: username_0 on 2017-03-08)
  
  ```
  REPOSITORY          TAG       IMAGE ID       CREATED             SIZE
  an-image            1         X              26 seconds ago      279 MB
  
  ```
  
  when the docker image will be run, the following message is shown:
  
  ```
  No java installations was detected.
  Please go to http://www.java.com/getjava/ and download
  
  ```
  
  When Oracle JDK is deployed the docker image size is more than doubled!
  
  ```
  REPOSITORY          TAG       IMAGE ID       CREATED             SIZE
  an-image            2         X              26 seconds ago      666 MB
  
  ```
  
  **Discussion**
  
  When "Is there no Oracle JDK for docker" is googled only some links to docker image that contain docker are returned. When Oracle JDK is deployed in the docker image the size is more than doubled. I want to keep the docker images as small as possible, but the Oracle JDK seems to be larger than the image itself!
  
  **Question**
  
  Is there no Oracle JDK for docker?
  
  **Tags:** docker, oracle-jdk
  
  > **Comments:**
  > **username_1**: @username_2 feel free to jump in [chatops](https://chat.stackexchange.com/rooms/54506/chatops) if you want to discuss it :)  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2017-03-08. Score: 23 | Accepted answer
  
  No. Because you [cannot distribute Oracle JDK or JRE, the license in effect doesn't allow distribution](http://www.oracle.com/technetwork/java/javase/terms/license/index.html). When distributed by a third party (embedded with your app) all the liability for it not working is on that party. This is why you will not find Oracle JDK/JRE on any of the public Docker registries, or in any Linux package repositories for that matter.
  
  You can create your own image, and install Oracle JDK or JRE using the [webupd8team/java](https://launchpad.net/~webupd8team/+archive/ubuntu/java) package for Ubuntu/Debian.
  
  And if you are using Alpine Linux [this blog post](https://developer.atlassian.com/blog/2015/08/minimal-java-docker-containers/) explains which dependencies are required, and [links to StackOverflow](https://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead) for installation instructions.
  
  **Update**: Oracle has an official Docker image on the *Docker Store* now. <https://blogs.oracle.com/developers/official-docker-image-for-oracle-java-and-the-openjdk-roadmap-for-containers>
  
  Link to *Docker Store* Oracle Java Image - <https://store.docker.com/images/oracle-serverjre-8>
  
  > **Comments:**
  > **username_0**: https://hub.docker.com/r/anapsix/alpine-java/  
  > **username_3**: I wouldn't rely on it being available for long. As I wrote, the license from Oracle does not allow to publicly distribute it - only Oracle can legaly distribute their JDK or JRE. So basically, this repository is illegal and will most likely disappear.  
  > **username_3**: What you **can** do, is use their `Dockerfile`s on GitHub to get your own Docker image with Java. For example https://github.com/anapsix/docker-alpine-java/blob/master/8/121b13/jdk/unlimited/Dockerfile  
  > **username_0**: And once the docker image is created I am allowed to store it in our private docker registry?  
  > **username_3**: Yes. The license prohibits from publicly distributing the JDK/JRE in binary form.  
  > **username_4**: Ok, but this does not explain why Oracle does not provide docker image for Oracle JDK 10. They should.  
  
  ---
  
  ### Answer by username_1 on 2017-03-08. Score: 8
  
  As docker is not an operating system, no there's no JDK for docker.
  
  As I understand your question, it's that a full JDK is too large for your wishes, in this case you may try switching to just the JRE and include only necessary libraries.
  
  JDK is the acronym of Java Development Kit, JRE is the one for Java Runtime Engine. By "lazyness" due to the complexity to list every needed dependency no one strip down to the necessary libraries only, but that is the way to go if you wish to reduce the installed size to strict minimum.
  
  A more usable way could be strip off some of the installed things which are taking a lot of space:
  
  ```
  /usr/lib/jvm/jdk1.8.0_101$ du -hs *
  776K    bin
  4.0K    COPYRIGHT
  5.7M    db
  208K    include
  4.9M    javafx-src.zip
  187M    jre
  133M    lib
  4.0K    LICENSE
  2.0M    man
  4.0K    README.html
  4.0K    release
  21M     src.zip
  108K    THIRDPARTYLICENSEREADME-JAVAFX.txt
  176K    THIRDPARTYLICENSEREADME.txt
  
  ```
  
  There's two \*src.zip which can be removed, they won't be of use, and as you can see the lib directory is half the size and within it you have a bunch of things you don't really need:
  
  ```
  /usr/lib/jvm/jdk1.8.0_101$ du -hs lib/*
  120K    lib/amd64
  1.2M    lib/ant-javafx.jar
  18M     lib/ct.sym
  160K    lib/dt.jar
  20K     lib/ir.idl
  36K     lib/javafx-mx.jar
  400K    lib/jconsole.jar
  12K     lib/jexec
  60M     lib/missioncontrol
  4.0K    lib/orb.idl
  8.0K    lib/packager.jar
  2.4M    lib/sa-jdi.jar
  18M     lib/tools.jar
  34M     lib/visualvm
  
  ```
  
  You can without problem remove missoncontrol on a server, I assume you can get rid of visualvm also, you'll have to check if you need something in this lib directory, but I can't tell without knowing your app..
  
  One thing you should do in your dockerfile while installing oracle jdk is to remove the downloaded `.tar.gz` file which is roughly the same size as the resulting directory as `.jar` files are already compressed, the tar.gz is just there to "package" them.
  
  You have to do all this in the same `RUN` command, chaining with `&&` to avoid adding layers where you won't remove size by removing files from previous layer.
  
  
  ---
  
  ### Answer by username_2 on 2017-03-08. Score: 3
  
  There is no official Oracle JDK implementation provided by Docker. Docker used to support their own [Java library](https://hub.docker.com/_/java/) on hub.docker.com, but they deprecated it in favor of the actual OpenJDK implementation since it was "OpenJDK-specific since it was first introduced". Their reasoning:
  
  > As all of the major upstream Linux distributions are unwilling to redistribute Oracle Java in their own distribution channels, we have chosen to follow them. See references below on how each distribution does not distribute Oracle Java.
  
  So if you want to keep your Docker image as small as possible, consider using OpenJDK instead. There's an official [OpenJDK Dockerfile repository](https://hub.docker.com/_/openjdk/) or you can just use `docker pull openjdk`. The basic "easy to run" Dockerfile for OpenJDK 7 is as follows (taken from the website listed in the previous sentence):
  
  ```
  FROM openjdk:7
  COPY . /usr/src/myapp
  WORKDIR /usr/src/myapp
  RUN javac Main.java
  CMD ["java", "Main"]
  
  ```
  
  > **Comments:**
  > **username_3**: There is no official Oracle JDK? That seems somewhat incorrect, or at least phrased incorrectly.  
  > **username_1**: @username_3 I agree, I assume the intent is to say: "No official docker image including Oracle JDK from Oracle", maybe  just a "docker " missing between JDK and implementation...  
  > **username_2**: Oops, yes I did mean to make that Docker specific. I have corrected my answer.  
  
  ---
  
  