In this chapter we introduce a new way of running the Java Spring Boot microservice: Inside a Docker container. You will get to download the source code, compile the service and launch it inside an own virtualized server that runs inside your host machine. Docker is currently our choise of technology for launching the service. Docker is an architecture that can be utilized for running a new virtualized computer instances. This means that it has it's own memory and disk where the service will be installed in.
These instructions are tested only on a Windows host machine, they may apply also to Mac and Unix based systems. The commands running the container should apply to all environments.
You have to have the following setup installed on your host machine.
Oralce VirtualBox On Window machines. This is required to start a virtual machine.
You will also need the source code project from the end of the article to compile, run and install as a microservice inside the container.
Code Build and Run a new Microservice Spring boot application
The Docker needs a recipe file for the setup, h...
The Dockerfile has the following setup:
ADD messaging-0.0.2-SNAPSHOT.jar messaging.jar
RUN sh -c 'touch /messaging.jar'
With just this setup you are able to launch the...
You will also need a new maven plugin to build ...LOGIN TO READ FULL ARTICLE
Now that you have installed the Docker or the D...
You have to launch the Docker instance inside t...
Change the directory to the folder where you ex...
cd /c/[your workspace directory]/messaging
mvn package docker:build
docker run -p 8080:8080 -t springio/messaging&n...
Press Control + C to return back to the shell. ...LOGIN TO READ FULL ARTICLE
The command prints out the list of your Docker ...
http://[YOUR DOCKER CONTAINER IP ADDRESS]:[8080...
The final URL depends on the machine that you'r...
This test fetches all the fresh message from th...
So go to the previous chapter and do the same P...
To stop the Docker container use the commands&n...
docker stop [CONTAINER ID]
Now you have the Hashtag messaging API up and r...
|Old version v0.0.1||New version v0.0.2.1D|
Dockerfile JAR version
|API version /v0.0.1/messages||/v0.1/messages|