Description of the project: a User places an Order by purchasing a set of Products. When the Order is still open, other Products can be added. Once the Order has been confirmed, this will then be accepted and closed once that has been delivered. The User can then decide to seek compensation once the Order has been processed. Models in Java/MongoDB: User, Product, Order. This guide walks you through the process of building a Docker image for running a Spring Boot 2 App with Mongo DB.
Docker is a Linux container management toolkit with a "social" aspect, allowing users to publish container images and consume those published by others. A Docker image is a recipe for running a containerized process, and in this guide we will build one for a simple Spring Boot 2 App.
-
about 15 minutes
-
jdk: Oracle or Alpine version 1.8 or later
-
[IntelliJ IDEA] https://spring.io/guides/gs/intellij-idea/ or a favourite text editor or IDE
-
[Spring Tool Suite (STS)] https://spring.io/guides/gs/sts/
-
[Apache Maven 3.2+] http://maven.apache.org/download.cgi
You can also import the code straight into your IDE
If you want to run with Maven, execute:
./mvn package && java -jar target/api-test-0.0.1-SNAPSHOT.jar
and go to http://localhost:8080/ to see the API TEST home page.
Congratulations! You’ve just created a Docker container for a Spring Boot 2 App!
Basically the Spring Boot 2 Apps run on port 8080 inside the container by default and we mapped that to the same port on the host using "-p" on the command line.
The following guides may also be helpful: