Gradle docker container ignores cache when started from Jenkinsfile
I believe that Jenkins Docker Plugin always runs containers as the jenkins
user. It looks like your gradle image is assuming that it is running as the gradle
user. You might try adding the following option:
-e GRADLE_USER_HOME=/home/gradle/.gradle
Though you might run into permission issues with that.