when I use docker run -it gradle:8.4.0-jdk17 /bin/bash & gradle -v it fails with 2 error
docker run -it gradle:8.4.0-jdk17 /bin/bash root@17a01c65ds84:/home/gradle# gradle -v ls: cannot access '/usr/bin/gradle': Operation not permitted
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.
Running docker run with privileged command helped.