Reputation: 1888
I am trying to create a image using JRE without any OS. I tried this Dockerfile which does not work.
FROM openjdk:11.0.1-jdk-oraclelinux7 as JDK
RUN jlink --no-header-files --no-man-pages --add-modules java.base,java.desktop,java.logging,java.sql --output /jre
FROM scratch
#FROM oraclelinux:7-slim
COPY --from=JDK /jre /jre
ARG JAR_FILE
COPY ${JAR_FILE} /app.jar
CMD ["/jre/bin/java", "-jar", "/app.jar"]
I am getting following error:
standard_init_linux.go:190: exec user process caused "no such file or directory"
If I replace scratch with oraclelinux, it works fine. Any clue why I cannot use scratch. The reason to use scratch is to reduce the size of the image.
Any help is appreciated.
Upvotes: 7
Views: 3488
Reputation: 94
The hotspot sources do not currently support statically linking. See http://mail.openjdk.java.net/pipermail/hotspot-dev/2013-September/010810.html for more info.
Upvotes: 3