Dockerizing a Spring Boot Application

Dockerizing a Spring Boot Application

make Dockerfile in the root folder and add the following line

FROM openjdk:8-jdk-alpine
ADD /build/libs/asset-management-service.jar asset-management-service.jar
ENTRYPOINT ["java","-jar","/asset-management-service.jar"]
EXPOSE 9195

save file with the name of Dockerfile.
Type the following command is used to remove exiting container 
 sh 'sudo docker rm $(sudo docker stop $(sudo docker ps -a | grep "work-order-service" | cut -d " " -f 1))'
sh 'sudo docker build -t work-order-service .'
sh 'sudo docker run -d work-order-service'
sh 'sudo docker ps -a | grep work-order-service'


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *