Getting Started with Amazon Corretto 11 on Docker Images - Amazon Corretto 11

Getting Started with Amazon Corretto 11 on Docker Images

This topic describes how to build and launch a Docker image that uses Amazon Corretto 11. You must have the latest version of Docker installed.

Using the official image for Amazon Corretto 11.

Amazon Corretto 11 is available as an official image on Docker Hub. The following example runs a container and displays Corretto 11's version.

docker run amazoncorretto:11 java -version


openjdk version "11.0.23" 2024-04-16 LTS OpenJDK Runtime Environment Corretto- (build 11.0.23+9-LTS) OpenJDK 64-Bit Server VM Corretto- (build 11.0.23+9-LTS, mixed mode)

Using the Corretto ECR Instance


The Corretto ECR Private Registry located at is now deprecated. Please migrate existing usages to the Corretto ECR Public Gallery. See corretto-docker#154 for more information.

To use the Corretto ECR instance, run the following commands:

docker pull docker run -it /bin/bash

You can see the list of available images by going here:

Amazon Corretto on Alpine

Amazon Corretto on Alpine Linux images are available on Amazon ECR Public Gallery and Dockerhub

Using dockerhub

docker pull amazoncorretto:11-alpine-jdk docker run -it amazoncorretto:11-alpine-jdk /bin/sh

Build a Docker Image with Amazon Corretto 11

Run the following command to build an image that uses Amazon Corretto 11.

docker build -t amazon-corretto-11

After the command completes, you have an image called amazon-corretto-11.

To launch this image locally, run the following command.

docker run -it amazon-corretto-11

You can also push this image to Amazon ECR. See the Pushing an Image topic in the Amazon Elastic Container Registry User Guide for details.

Create an Image

You can create a new Docker image using Corretto's official Docker Hub image.

  1. Create a Dockerfile with the following content.

    FROM amazoncorretto:11 RUN echo $' \ public class Hello { \ public static void main(String[] args) { \ System.out.println("Welcome to Amazon Corretto!"); \ } \ }' > RUN javac CMD ["java", "Hello"]
  2. Build the new image.

    docker build -t hello-app .
  3. Run the new image.

    docker run hello-app

    You get the following output.

    Welcome to Amazon Corretto!