- The project
jar
must be built before the docker build. - If the
target
folder doesn't exist, run the following command:$ mvn clean package
- Make sure Docker engine is running
- Build the docker image using the command:
$ docker build -t spring-boot-docker:spring-docker .
- Run the container:
$ docker run -p 8080:8080 spring-boot-docker:spring-docker .
- Test by visiting the endpoint:
http://localhost:8080/
- Open
pom.xml
- Update the
version
element underproject
- NOTE: If the version is changed, the
jar
file name must be updated with the correct version in the Dockerfile
- Root -
GET
/ - Greet -
GET
/greet/{name} - Health Check -
GET
/health/ready - Version Check -
GET
/version