Skip to content

Latest commit

 

History

723 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gradle Docker Image

Project Status: Active License Build status

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.

Supported Tags

See all tags on Docker Hub.

Native Image variants

The -graal variants use BellSoft Liberica Native Image Kit (NIK), an open-source distribution of OpenJDK and GraalVM with the native-image compiler included. The existing image tags and /opt/java/graalvm installation paths are retained for compatibility. These images use the standard Linux bundle for AMD64 and ARM64.

Liberica NIK provides maintained Java 17 and 21 distributions, replacing the discontinued upstream GraalVM Community Edition binaries for those Java versions. NIK's OpenJDK and GraalVM components use GPLv2 with the Classpath Exception, together with applicable component licenses; see the NIK license.

The jdk-lts-and-current-graal combo image is retired. Use the Java-specific -graal images instead; the current Native Image distribution uses Java 25 for both LTS and current.

Combo images

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.

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_HOME

Available environment variables:

  • JAVA_LTS_HOME → path to the latest LTS JDK
  • JAVA_CURRENT_HOME → path to the latest current JDK

These may point to the same path if the latest JDK is an LTS release.

Usage

Build a Gradle project

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.

Reusing the Gradle User Home

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 build

Note 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.

License

Apache License 2.0.

© Gradle Inc. 2025

Used by

Contributors

Languages