openjdk-docker icon indicating copy to clipboard operation
openjdk-docker copied to clipboard

jlink fails on alpine-slim with java.desktop

Open ceeaspb opened this issue 6 years ago • 1 comments

jlink fails in the alpine-slim image.

FROM adoptopenjdk/openjdk11:alpine-slim

RUN ["jlink", "--compress=2", \
     "--add-modules", "java.base,java.desktop", \
     "--output", "/linked"]
$ docker build .
Sending build context to Docker daemon  6.144kB
Step 1/2 : FROM adoptopenjdk/openjdk11:alpine-slim
 ---> 11ec9a62b568
Step 2/2 : RUN ["jlink", "--compress=2",      "--add-modules", "java.base,java.desktop",      "--output", "/linked"]
 ---> Running in 23566d540cb3
Error: Module java.desktop not found
The command 'jlink --compress=2 --add-modules java.base,java.desktop --output /linked' returned a non-zero code: 1

The desktop module is reported as being present.

# java --list-modules |grep desk
[email protected]
[email protected]

It might be removing jmod files that is breaking jlink in the slim builds.

Consider fixing jlink to be supported in slim images, or remove jlink and associated tools from the slim build and point people towards running jlink against the non-slim build.

[this problem might be hit if beans are used.]

ceeaspb avatar Aug 16 '19 15:08 ceeaspb

I would say that detecting of existing modules via java --list-modules is not working correctly. Not sure how to proceed, probably best to ask on JDK mailing list

grzesuav avatar Jan 11 '20 22:01 grzesuav