amazoncorretto
A multiplatform, production-ready distribution of OpenJDK provided and supported by Amazon.
What is amazoncorretto?
The Amazon Corretto image packages Amazon Corretto, a free, multiplatform, production-ready distribution of OpenJDK provided and supported by Amazon. Corretto includes long-term support with performance enhancements and security updates.
It is certified as compatible with the Java SE standard and is designed to be a drop-in replacement for other OpenJDK distributions. Amazon uses Corretto internally for running Java workloads on AWS services, which adds to its credibility for production systems.
Corretto is frequently chosen as a base image for Java applications deployed on AWS, but it can be used in any environment that requires a stable and secure JDK or JRE.
How to use this image
The Amazon Corretto image can be used to build and run Java applications.
Examples:
<code># Run Java version check
docker run --rm amazoncorretto:21 java -version</code>
<code># Compile a Java application
docker run --rm -v $PWD:/app -w /app amazoncorretto:17 javac HelloWorld.java</code>
<code># Run the application
docker run --rm -v $PWD:/app -w /app amazoncorretto:17 java HelloWorld</code>
Corretto images are also commonly used in multi-stage builds for CI/CD pipelines:
<code>FROM amazoncorretto:21 as build
WORKDIR /src
COPY . .
RUN javac MyApp.java</code>
<code>FROM amazoncorretto:21
WORKDIR /app
COPY --from=build /src/MyApp.class .
ENTRYPOINT ["java","MyApp"]</code>
Image variants
The Amazon Corretto image is published under amazoncorretto
and available in multiple variants:
amazoncorretto:<version>
Version-pinned images (e.g., amazoncorretto:17
, amazoncorretto:21
). These correspond to specific Java LTS or feature releases.
amazoncorretto:<version>-alpine
A lightweight Alpine Linux–based variant, providing smaller image size and reduced attack surface.
amazoncorretto:latest
Tracks the most recent stable release. Useful for testing, but not recommended for long-term production deployments.