Installing Java on docker in docker image

I want to install the openjdk on the docker in docker image. When I try this is get this error message:

  • Is it possible to assign a static public ip to a Docker Container?
  • Daemonized buildbot start
  • Installing Docker on an isolated (no internet) Centos 7 box?
  • Image and container in docker after a new build
  • Docker Server for Multiple Users
  • Can't access publicly exposed Docker container port from external machine, only from localhost?
  • 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  && apk add --no-cache       openjdk8="$JAVA_ALPINE_VERSION" && [ "$JAVA_HOME" = "$(docker-java-home)" ]' returned a non-zero code: 1
    

    My Dockerfile currently looks like this:

    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)")")"'; \
        } > /usr/local/bin/docker-java-home \
        && 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 \
        && apk add --no-cache \
            openjdk8="$JAVA_ALPINE_VERSION" \
    && [ "$JAVA_HOME" = "$(docker-java-home)" ]
    

  • Artifactory Professional License - NFS
  • gsub encoding error when running on Linux Docker Container Invalid byte sequence in US-ASCII
  • Hazelcast in multinode docker environments with TCPIP
  • Google Cloud Container Registry Issues while pushing docker images
  • kafka image build kompose
  • Is it possible change date in docker container?
  • One Solution collect form web for “Installing Java on docker in docker image”

    There’s a Dockerfile reference on how official Java image is baking on top of alpine image:
    https://github.com/docker-library/openjdk/blob/9a0822673dffd3e5ba66f18a8547aa60faed6d08/8-jdk/alpine/Dockerfile

    Or you could do it another way around,

    # build ontop of official Java image
    FROM java:openjdk-8-jdk-alpine
    
    RUN apk update && \
        apk add docker
    ...
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.