The official Docker image for Gradle. Maintained by the Gradle team as an Official Image. Thanks to @keeganwitt for his years of stewardship.
Gradle is a fast, dependable, and adaptable open-source build automation tool with an elegant and extensible declarative build language.
- JDK 8 →
jdk8,jdk8-jammy,jdk8-corretto,jdk8-ubi9 - JDK 11 →
jdk11,jdk11-noble,jdk11-jammy,jdk11-alpine,jdk11-corretto,jdk11-ubi9 - JDK 17 →
jdk17,jdk17-noble,jdk17-jammy,jdk17-alpine,jdk17-corretto,jdk17-ubi9,jdk17-noble-graal - JDK 21 →
jdk21,jdk21-noble,jdk21-jammy,jdk21-alpine,jdk21-corretto,jdk21-ubi9,jdk21-graal - JDK 25 (LTS) →
jdk25,jdk25-noble,latest,jdk25-alpine,alpine,jdk25-corretto,corretto,jdk25-ubi10,ubi,jdk25-graal,graal
See all tags on Docker Hub.
Combo images are images where two different JDK versions are made available to Gradle: the latest LTS JDK and the latest (LTS or non-LTS) JDK. Gradle runs on the LTS JDK, while toolchains can target the latest JDK.
- Combo Images →
jdk-lts-and-current,jdk-lts-and-current-alpine,jdk-lts-and-current-corretto,jdk-lts-and-current-graal
To achieve this, the following appears in the /home/gradle/.gradle/gradle.properties file of the image:
org.gradle.java.installations.auto-detect=false
org.gradle.java.installations.auto-download=false
org.gradle.java.installations.fromEnv=JAVA_LTS_HOME,JAVA_CURRENT_HOMEAvailable environment variables:
JAVA_LTS_HOME→ path to the latest LTS JDKJAVA_CURRENT_HOME→ path to the latest current JDK
These may point to the same path if the latest JDK is an LTS release.
docker run --rm -u gradle \
-v "$PWD":/home/gradle/project \
-w /home/gradle/project \
gradle:latest gradle <task>Replace <task> with your desired Gradle task, e.g., build.
To persist the Gradle User Home (including Gradle caches) between runs:
docker volume create --name gradle-cache
docker run --rm -u gradle \
-v gradle-cache:/home/gradle/.gradle \
-v "$PWD":/home/gradle/project \
-w /home/gradle/project gradle:latest gradle buildNote that sharing between concurrently running containers doesn't work currently (see #851).
Currently, it is not possible to override the volume declaration of the parent.
If you are using this image as a base image and want the Gradle cache to be written into the next layer, you will need to use a new user (or use the --gradle-user-home/-g argument) so that a new cache is created that isn't mounted to a volume.
© Gradle Inc. 2025