gradle

An image used in the Java ecosystem for managing dependencies, compiling code, running tests, and packaging applications.

openjdk
eclipse-temurin
kotlin
maven

What is gradle?

The Gradle image provides the Gradle build tool bundled with a Java Development Kit (JDK). Gradle is widely used in the Java ecosystem for managing dependencies, compiling code, running tests, and packaging applications.

This image is particularly useful for CI/CD pipelines, where builds can run in a consistent environment without needing to install Gradle or the JDK directly on the host. Because the image includes both Gradle and a JDK, developers can use it to build, test, and publish JVM-based applications with minimal setup.

Gradle excels at incremental builds, caching, and supporting both Java and other JVM languages (like Kotlin and Groovy). When used in containers, it provides reproducible builds and simplifies automation in distributed systems.

How to use this image

The Gradle image can be used for interactive builds or as part of automated pipelines.

Examples:

<code># Run a temporary Gradle container and check the version
docker run --rm gradle gradle --version</code>

<code># Mount your project and build it with Gradle
docker run --rm -v $PWD:/home/gradle/project -w /home/gradle/project gradle gradle build</code>

<code># Use Gradle in CI/CD to run tests
docker run --rm -v $PWD:/home/gradle/project -w /home/gradle/project gradle gradle test</code>

By default, the image sets up a gradle user (UID 1000) and mounts /home/gradle/.gradle as a volume to persist caches between builds, speeding up repeated runs.

{{cta2}}

Image variants

The Gradle image is available in several variants, mostly distinguished by JDK version and base distribution:

gradle:jdk21

Includes Gradle with Eclipse Temurin JDK 21. This is the recommended default for most modern projects since JDK 21 is the current long-term support release. Use this if your application targets Java 21.

gradle:jdk17

Includes Gradle with Eclipse Temurin JDK 17, another long-term support release. Choose this variant if your application is pinned to Java 17 for compatibility or support reasons.

gradle:alpine

A lightweight variant based on Alpine Linux, available with different JDK versions (e.g., gradle:jdk21-alpine). It offers a smaller footprint and faster pulls, but uses musl instead of glibc, which may impact compatibility with some Java libraries or native binaries.

gradle:slim

Built on a slimmed-down Debian base image. These variants trade off a slightly larger image size for broader compatibility and ease of debugging compared to Alpine.

Interested in base images that start and stay clean?

This is a not a valid email
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Interested in a CVE-free gradle?

Pull echo’s gradle image for a CVE-free base. Automatically patched and hardened for you.