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.
Create a simple parent image using scratch Assuming you built the “hello” executable example by using the source code at https://github.com/docker-library/hello-world, and you compiled it with the -static flag, you can build this Docker image using this docker build command: $ docker build --tag hello .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With