title: Installing Java on docker in docker image
body: <p>I want to install the openjdk on the docker in docker image. When I try this is get this error message:</p>
  
  <p><pre><code></p>
  
  <pre><code>fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community
  ERROR: unsatisfiable constraints:
    openjdk8-8.121.13-r0:
      breaks: world[openjdk8=8.111.14-r0]
  The command '/bin/sh -c set -x  &amp;&amp; apk add --no-cache       openjdk8="$JAVA_ALPINE_VERSION" &amp;&amp; [ "$JAVA_HOME" = "$(docker-java-home)" ]' returned a non-zero code: 1
  </code></pre>
  
  <p></pre></code></p>
  
  <p>My Dockerfile currently looks like this:
  <pre><code></p>
  
  <pre><code>FROM docker:latest
  RUN apk update
  ENV LANG C.UTF-8
  RUN { \
          echo '#!/bin/sh'; \
          echo 'set -e'; \
          echo; \
          echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
      } &gt; /usr/local/bin/docker-java-home \
      &amp;&amp; chmod +x /usr/local/bin/docker-java-home
  ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
  ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
  ENV JAVA_VERSION 8u111
  ENV JAVA_ALPINE_VERSION 8.111.14-r0
  RUN set -x \
      &amp;&amp; apk add --no-cache \
          openjdk8="$JAVA_ALPINE_VERSION" \
  &amp;&amp; [ "$JAVA_HOME" = "$(docker-java-home)" ]
  </code></pre>
  
  <p></pre></code></p>