gradle image failing with JAVA_HOME is set to an invalid directory

105 Views Asked by At

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.

1

There are 1 best solutions below

1
Mahesh Pawar On

Running docker run with privileged command helped.

docker run --privileged=true