---
title: "Discussion on \"Why Your Docker Container Should Never Run as Root (And How to Fix It)\" | Hashnode"
description: "Discussion on \"Why Your Docker Container Should Never Run as Root (And How to Fix It)\". Imagine you made any spring boot application and created docker file which look like this\nFROM openjdk:17-jdk-slim\nCOPY target/myapp.jar app.jar\nENTRYPOINT [\"java\", \"-jar\", \"/app.jar\"]\n\nThis container runs as a root\nThe problem with this approach..\nW..."
url: "https://hashnode.com/posts/why-your-docker-container-should-never-run-as-root-and-how-to-fix-it/68cadf41e45a2aeef33bb19f"
---

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

Discussion

# [Why Your Docker Container Should Never Run as Root (And How to Fix It)](https://why-not-to-run-doc-containers-as-root.hashnode.dev/why-your-docker-container-should-never-run-as-root-and-how-to-fix-it?utm_source=hashnode&utm_medium=feed)

Imagine you made any spring boot application and created docker file which look like this FROM openjdk:17-jdk-slim COPY target/myapp.jar app.jar ENTRYPOINT \["java", "-jar", "/app.jar"\] This container runs as a root The problem with this approach.. W...

Sep 17, 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.
