DevOps Classroom notes 12/Jun/2026

Multi-staged docker image build

  • Java:
    • To build java application i might need
      • JDK
      • Maven/Gradle
    • To run the java application i need
      • JRE
  • Dotnet:
    • To build dotnet application i need
      • dotnet SDK
    • To run the dotnet application i need
      • dotnet Runtime
  • To solve this docker introduced multi staged Docker file
  • i.e in Dockerfile i can have multiple stages, only last stage will be your application image
  • Example
FROM maven:3-eclipse-temurin-21 AS build
COPY . /app
WORKDIR /app
RUN mvn package


FROM eclipse-temurin:21-jre-alpine 
RUN mkdir /app
COPY --from=build /app/target/spring-petclinic-4.0.0-SNAPSHOT.jar /app
WORKDIR /app
EXPOSE 8080
CMD ["java", "-jar", "spring-petclinic-4.0.0-SNAPSHOT.jar"]

Securing docker images

  • Docker gives docker hardened images (DHI) and there are distroless images
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%