MARKA
MARKA

Reputation: 1

How to install java 11 in a container with openjdk11 and dockerfile

I have this dockerfile:

FROM ubuntu:latest

COPY /components/openjdk/files  /
COPY  OpenJDK11U-jdk_x64_linux_openj9_11.0.10_9_openj9-0.24.0.tar.gz /
ARG VER_OPENJDK=11

ENV JAVA_HOME=/usr/lib/jvm/java-${VER_OPENJDK}-openjdk-amd64 \
    PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin:/$PATH"

RUN set -e; \
    echo "-- Deploy jre11"; \
    mkdir -p ${JAVA_HOME}; \
    tar zxvf OpenJDK11U-jdk_x64_linux_openj9_11.0.10_9_openj9-0.24.0.tar.gz -C ${JAVA_HOME} ;

and I built the image but when exectuing the container by : docker exec -it id_container bash, and write inside the container the command $java -version, I got: "bash: java: command not found". I think I should add some commands in the container to fix the problem and then added them to the dockerfile.

Thank you for your help.

Upvotes: 0

Views: 5678

Answers (1)

user12640668
user12640668

Reputation:

Please use the following official image is based on ubuntu.

docker pull adoptopenjdk/openjdk11

Upvotes: 1

Related Questions