从头开始为JRE创建Docker映像 [英] Create Docker Image For JRE FROM scratch

查看:177
本文介绍了从头开始为JRE创建Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用不带任何操作系统的JRE创建映像。我尝试了这个不起作用的Dockerfile。

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"]

我收到以下错误消息:

    standard_init_linux.go:190: exec user process caused "no such file or directory"

如果我将scratch替换为oraclelinux,它可以正常工作。为什么我不能使用草稿任何线索。使用草稿的原因是减小图像的大小。

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.

我们将不胜感激。

推荐答案

热点源当前不支持静态链接。参见 http://mail.openjdk.java.net /pipermail/hotspot-dev/2013-September/010810.html 了解更多信息。

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.

这篇关于从头开始为JRE创建Docker映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆