---
title: "Discussion on \"Docker multi-stage build for efficiency\" | Hashnode"
description: "Discussion on \"Docker multi-stage build for efficiency\". The problem with the single-stage build\nFROM openjdk:17\nWORKDIR /app\nCOPY . .\nRUN ./mvnw package\nCMD [\"java\", \"-jar\", \"target/myapp.jar\"]\n\nAbove code is the example of the single stage build\nThe issue with this approach\n\nLarge image size - Since the ..."
url: "https://hashnode.com/posts/docker-multi-stage-build-for-efficiency/68d932a7cda91a79d2d89145"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Docker multi-stage build for efficiency](https://why-not-to-run-doc-containers-as-root.hashnode.dev/docker-multi-stage-build-for-efficiency?utm_source=hashnode&utm_medium=feed)

The problem with the single-stage build FROM openjdk:17 WORKDIR /app COPY . . RUN ./mvnw package CMD \["java", "-jar", "target/myapp.jar"\] Above code is the example of the single stage build The issue with this approach Large image size - Since the ...

Sep 28, 2025 · 2 min read · why-not-to-run-doc-containers-as-root.hashnode.dev  
Read the article

-   [#docker](https://hashnode.com/tag/docker)
-   [#springboot](https://hashnode.com/tag/springboot)

## Written by

[Ansul kumar yadav](https://hashnode.com/@Weblearner)

@Weblearner · India

  
[View profile](https://hashnode.com/@Weblearner)

Devops | Docker & K8s | Terraform | Jenkins |CI/CD | Linux | AWS | Spring Boot | Java | DSA

I’m a Spring Boot Developer and DevOps Engineer with strong experience in building scalable, secure, and high-performance applications. Whether you’re looking to develop a modern web application, streamline your infrastructure, or build cloud-native solutions on AWS, I can help. What I do best: Backend development using Spring Boot on the backend DevOps automation and CI/CD pipeline setup Cloud architecture and deployment on AWS (EC2, S3, Lambda, ECS, CloudWatch, IAM, etc.) Microservices design, development, and integration Infrastructure as Code (IaC) using Terraform or CloudFormation Containerization and orchestration with Docker and Kubernetes

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
