Redeploy spring-boot application in docker container? Redeploy spring-boot application in docker container? docker docker

Redeploy spring-boot application in docker container?


You could mount a volume and put your app.jar in there. So you do not need to rebuild the image, you just restart the container.

Dockerfile

FROM java:8ENTRYPOINT [ "sh", "-c", "java -jar /mnt/app.jar" ]

Put your app.jar in /docker/spring/

Build and run:

docker build -t spring_test .docker run -d -v /docker/spring/:/mnt -p 12384:8080 --name spring_test_running spring_test

If you update your spring application you just do:

docker restart spring_test_running


The previous answer is good. But there is need to restart container every time when you want to test your code. But we can avoid this problem. Just use Spring dev tool And mount destination directory as described above.