containers
containers copied to clipboard
17.0.3_7 build not working with gradlew
Version 17.0.2_8 works as expected, but version 17.0.3_7 fails. Gradle version is 7.4.2 In our dockerfile we have:
FROM eclipse-temurin:17.0.2_8-jdk AS build
RUN mkdir /home/uswf
COPY . /home/uswf
WORKDIR home/uswf
RUN chmod +x ./gradlew
RUN ./gradlew clean build
After executing the last line with version 17.0.3_7 gradlew puts out the following error: "ERROR: JAVA_HOME is set to an invalid directory: /opt/java/openjdk Please set the JAVA_HOME variable in your environment to match the location of your Java installation."
All of the directories seem correct, but the only change was the upgrade of the java version.
Shouldn't that first line be FROM eclipse-temurin:17.0.3_7-jdk AS build
?
I can't seem to reproduce this error
Shouldn't that first line be
FROM eclipse-temurin:17.0.3_7-jdk AS build
?I can't seem to reproduce this error
When the line is changed to FROM eclipse-temurin:17.0.3_7-jdk AS build
the error happens.
JAVA_HOME
seems to be valid to me:
docker run -it eclipse-temurin:17.0.3_7-jdk /bin/bash
$JAVA_HOME/bin/java -version
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
Here is the relevant code in gradlew: (I inserted the echo command to confirm the JAVACMD is properly set)
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
echo "JAVACMD: $JAVACMD"
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
Here is the output from using 17.0.3_7-jdk: (FAILS)
Status: Downloaded newer image for eclipse-temurin:17.0.3_7-jdk
---> 0bc7a4cbe8fe
Step 2/9 : RUN mkdir /home/uswf
---> Running in 062c8af97366
Removing intermediate container 062c8af97366
---> adef6b175d68
Step 3/9 : COPY . /home/uswf
---> 3dbdaa7c7648
Step 4/9 : WORKDIR home/uswf
---> Running in 8032fe152cbb
Removing intermediate container 8032fe152cbb
---> 7393a5f4a16c
Step 5/9 : RUN chmod +x ./gradlew
---> Running in 8b16f82bd5b4
Removing intermediate container 8b16f82bd5b4
---> 4f05c7cbd9aa
Step 6/9 : RUN ./gradlew clean build
---> Running in 0520fbe4b0df
[91m
ERROR: JAVA_HOME is set to an invalid directory: /opt/java/openjdk
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
[0mJAVACMD: /opt/java/openjdk/bin/java
The command '/bin/sh -c ./gradlew clean build' returned a non-zero code: 1
Here is the output from using 17.0.2_8-jdk: (SUCCESSFUL)
Status: Downloaded newer image for eclipse-temurin:17.0.2_8-jdk
---> f6e55a6665a7
Step 2/9 : RUN mkdir /home/uswf
---> Running in 85b5679d94ec
Removing intermediate container 85b5679d94ec
---> 8dca1bf7e6d4
Step 3/9 : COPY . /home/uswf
---> e51dbd960306
Step 4/9 : WORKDIR home/uswf
---> Running in efe79fe05010
Removing intermediate container efe79fe05010
---> dc8da93f721e
Step 5/9 : RUN chmod +x ./gradlew
---> Running in 1be0517ac209
Removing intermediate container 1be0517ac209
---> 7bc4f882326c
Step 6/9 : RUN ./gradlew clean build
---> Running in 3e43a3b71572
JAVACMD: /opt/java/openjdk/bin/java
Downloading https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
This could be the docker version problem? See https://github.com/adoptium/temurin-build/issues/2974#issuecomment-1150881706
@ctwoolsey what is the version of the Docker engine you are using?
Server: Docker Engine - Community Engine: Version: 19.03.12 API version: 1.40 (minimum version 1.12) Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:44:07 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683
Ah yes, please update to the 20.x series of the engine and this should get fixed
Thanks for the suggestion. I'm waiting for the owner to update the docker version.
On Wed, Jul 6, 2022 at 1:23 PM Martijn Verburg @.***> wrote:
Ah yes, please update to the 20.x series of the engine and this should get fixed
— Reply to this email directly, view it on GitHub https://github.com/adoptium/containers/issues/230#issuecomment-1176103586, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6QVRWVYCCUBVJQQCBMEYTVSVUDFANCNFSM52M63SJQ . You are receiving this because you were mentioned.Message ID: @.***>
Upgrading to 20.x fixed the issue.