keeganwitt / docker-gradle

Docker images with Gradle
https://hub.docker.com/_/gradle/
Apache License 2.0
143 stars 73 forks source link

Gradle build failes with Docker image on MAC OS 14.5 SONOMA #287

Closed Margretor closed 2 months ago

Margretor commented 3 months ago

Hi,

Hardware: MacBook PRO Sonoma 14.5, M2 Max.

Using the docker run -it gradle:8.7.0-jdk-21-and-22-alpine sh image I am trying to run a gradle clean build and I get the following output:

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.For more details on the daemon, please refer to https://docs.gradle.org/8.7/userguide/gradle_daemon.html in the Gradle documentation.
Process command line: /opt/java/openjdk/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /opt/gradle/lib/gradle-launcher-8.7.jar -javaagent:/opt/gradle/lib/agents/gradle-instrumentation-agent-8.7.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.7
Please read the following process output to find out more:
-----------------------
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000000002b1c0, pid=44, tid=46
#
# JRE version: OpenJDK Runtime Environment Temurin-21.0.3+9 (21.0.3+9) (build 21.0.3+9-LTS)
# Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (21.0.3+9-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# C  [libnative-platform-file-events.so+0x2eb8c]  _init+0x39e4
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Running the same docker image on a Linux X86 laptop I get the following output which is expected:

FAILURE: Build failed with an exception.

* What went wrong:
Directory '/home/gradle' does not contain a Gradle build.

A Gradle build should contain a 'settings.gradle' or 'settings.gradle.kts' file in its root directory. It may also contain a 'build.gradle' or 'build.gradle.kts' file.

To create a new Gradle build in this directory run 'gradle init'

For more information about the 'init' task, please refer to https://docs.gradle.org/8.7/userguide/build_init_plugin.html in the Gradle documentation.

For more details on creating a Gradle build, please refer to https://docs.gradle.org/8.7/userguide/tutorial_using_tasks.html in the Gradle documentation.

* Try:
> Run gradle init to create a new Gradle build in this directory.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org/.

BUILD FAILED in 1s

How can I proceed further in order to use the gradle image on my local machine?

keeganwitt commented 3 months ago

Let me check with the Docker Library folks if there's an issue with the Jenkins build.

keeganwitt commented 3 months ago

It seems to be an issue with ARM in general and not just with the new LTS and current JDK images. This can be reproduced with

docker run -it --rm --platform=linux/arm64/v8 gradle:8.7.0-jdk21-alpine gradle clean

Even on non-ARM devices (emulation).

keeganwitt commented 3 months ago

This doesn't happen with the 8.8 image. This is because Gradle 8.8 fixed gradle/gradle#24875. Please try again with 8.8.

keeganwitt commented 2 months ago

Closing old issue. If this is still a problem, let me know and I'll re-open it.

Margretor commented 2 months ago

Gradle 8.8 image works as intended, thank you!