An example how to start Spring Boot in Docker with hot reload and debug mode
docker compose up
# build a docker image
docker build -t spring-examples .
# start the image
docker run -d -p 8080:8080 -p 5005:5005 spring-examples
- Create .vscode/launch.json with:
{ "configurations": [ { "type": "java", "name": "Docker Spring Boot-ApiApplication", "request": "attach", "projectName": "api", "hostName": "localhost", "port": 5005 }, ] }
- start the app -
docker compose up
- in VSCode - click
Run and Debug
->Start Debugging