Dockerize the spring boot application
248
This spring boot application contains following
Install docker toolbox
https://www.docker.com/products/docker-toolbox
Maven command to build the docker image.
git clone https://github.com/Arun4D/spring-boot-docker.git
mvn clean install
docker build -t spring-boot-docker:latest -f Dockerfile .
docker run --name spring-boot-docker-v1 -e "SPRING_PROFILES_ACTIVE=default" -e "SERVER.PORT=10000" -p 10000:10000 -t spring-boot-docker:v1
Note: Run
docker-machine env defaultin the cmd / bash to identify the docker.
The default h2 console url to run this spring boot application in local environment
http://localhost:10000/console/
Note: Port is based on SERVER.PORT configuration. Default spring boot server port 8080
If this application running in docker.
$ docker-machine ip default
192.168.99.100
http://192.168.99.100:10000/console/
Note: Assumed that
defaultdocker machine is used. If different docker machine used usedocker-machine ip <docker-machine name>
Use the following details to connect to the database.
JDBC URL : jdbc:h2:mem:PersonDB
User Name : sa
password :
Open the browser and hit the following url to invoke the service.
http://192.168.99.100:10000/person?firstName=arun&lastName=duraisamy
Content type
Image
Digest
Size
150.6 MB
Last updated
over 9 years ago
docker pull arun4d/spring-boot-docker