How to Dockerize a Spring Boot App_
How to Dockerize a Spring Boot App_
Sheet.
what is Docker?
How to dockerize a spring boot app?
1. Create a Dockerfile at the root level of your Project and below commands into it.
Dockerfile content :
FROM openjdk:17-jdk-slim: Uses a lightweight Java 17 image.
WORKDIR /app: Sets /app as the working directory inside the container.
COPY target/my-spring-app.jar app.jar: Copies your built app into the container.
docker build -t my-spring-app .
once this command execution is successful, an image will be created which can be viewed in
the Docker Desktop
This command will run the container and will start your application.
You can also find the containers running in Docker Desktop.