Search code examples
javadockeralpine-linuxcorretto

How to build corretto 17 alpine linux image using docker file


I am new to Docker, and I need help to build Corretto 17 Alpine Linux image. I have an existing Dockerfile which build Java 8 Alpine Linux image as below.

FROM alpine:3.17

# install software
RUN apk add --no-cache \
    bash \
    openjdk8-jre

How can I add Corretto 17 command to this Dockerfile to run my application on Corretto 17?


Solution

  • I found an aws doc to install Amazon Corretto 17 on Alpine Linux

    below is the command that neet to insert in your docker file to install corretto 17.

    FROM alpine:3.17
        RUN apk add --no-cache &&\
                wget -O /etc/apk/keys/amazoncorretto.rsa.pub https://apk.corretto.aws/amazoncorretto.rsa.pub && \
                echo "https://apk.corretto.aws" >> /etc/apk/repositories && \
                apk update &&\
                apk add amazon-corretto-17