Akshay
Akshay

Reputation: 23

/bin/sh: jlink: not found. command '/bin/sh -c jlink' returned a non-zero code: 127

the dockerfile used -

FROM azul/zulu-openjdk-alpine:11 as jdk

RUN jlink \
    --module-path /usr/lib/jvm/*/jmods/ \
    --verbose \
    --add-modules java.base,jdk.unsupported,java.sql,java.desktop \
    --compress 2 \
    --no-header-files \
    --no-man-pages \
    --output /opt/jdk-11-minimal

FROM alpine:3.10
ENV JAVA_HOME=/opt/jdk-11-minimal
ENV PATH=$PATH:/opt/jdk-11-minimal/bin
COPY --from=jdk /opt/jdk-11-minimal /opt/jdk-11-minimal

why jlink can't be found in azul/zulu-openjdk-alpine:11?

Upvotes: 2

Views: 1537

Answers (3)

Fabián
Fabián

Reputation: 51

I had the same problem. And it's an issue in the image https://github.com/zulu-openjdk/zulu-openjdk/issues/66

I tried with the version azul/zulu-openjdk-alpine:11.0.7-11.39.15 and it worked

Upvotes: 1

Speakjava
Speakjava

Reputation: 3392

The simple answer is jlink is not on the PATH so can't be found.

If you change the RUN line to

RUN /usr/lib/jvm/zulu11/bin/jlink

then it can be found.

However, you still have an error using the wildcard in the module path. Change this to

--module-path /usr/lib/jvm/zulu11/jmods/

and the docker command will complete successfully.

Upvotes: 4

Sergey Grinev
Sergey Grinev

Reputation: 34498

Please, use $JAVA_HOME/bin/jlink.

For historical reasons $JAVA_HOME/bin is not included in PATH, so you need to state it directly.

Upvotes: 2

Related Questions