View a markdown version of this page

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

Getting Started with Amazon Corretto 27 on Docker Images

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

Using the official image for Amazon Corretto 27.

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

Example
docker run amazoncorretto:27 java -version

Output:

Example
openjdk 27 2026-09-15 OpenJDK Runtime Environment Corretto-27.0.0.35.1 (build 27+35-FR) OpenJDK 64-Bit Server VM Corretto-27.0.0.35.1 (build 27+35-FR, mixed mode, sharing)

Using the Corretto ECR Instance

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

Example
docker pull public.ecr.aws/amazoncorretto/amazoncorretto:27 docker run -it public.ecr.aws/amazoncorretto/amazoncorretto:27 /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 Docker Hub

Using Docker Hub

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

Build a Docker Image with Amazon Corretto 27

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

Example
docker build -t amazon-corretto-27 github.com/corretto/corretto-docker#main:27/jdk/al2023

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

To launch this image locally, run the following command.

Example
docker run -it amazon-corretto-27

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.

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

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

    Example
    docker run hello-app

    You get the following output.

    Welcome to Amazon Corretto!