I am trying to create an docker image in alpine using Oracle Java (not openjdk). I was specifically asked to create our own image here.
This is the Docker file I came across:
FROM alpine:3.6
RUN apk add --no-cache curl wget
RUN mkdir /opt/ && \
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie"\
http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz && \
tar xvf jdk-8u131-linux-x64.tar.gz -C /opt/ && \
rm jdk-8u131-linux-x64.tar.gz && \
ln -s /opt/jdk1.8.0_131 /opt/jdk
ENV JAVA_HOME /opt/jdk
ENV PATH $PATH:/opt/jdk/bin
RUN echo $JAVA_HOME && \
echo $PATH
RUN which java
RUN java -version
There are some unnecessary commands (for example, repeating the JAR of the JAVA_HOME file) that were added to help with debugging, but now I'm stuck: RUN which javareturns /opt/jdk/bin/javaas expected, but RUN java -versionreturns /bin/sh: java: not found.
I tried several things, including a symlink to the executable in / usr / bin, to no avail.
What am I missing?
EDIT: Final exit from docker:
The command '/bin/sh -c java -version' returned a non-zero code: 127
Final editing:
diginoise MUSL vs libc. , Dockerfile :
RUN apk --no-cache add ca-certificates && \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk && \
apk add glibc-2.25-r0.apk
: https://github.com/sgerrand/alpine-pkg-glibc