Spring Boot java API + Postgres
A single resource API to demonstrate how to package a JAVA app with docker
Create a network
$ docker network create --driver bridge java_app_network
Run postgres in this network
docker run --net=java_app_network -p 5432:5432 \
-e POSTGRES_PASSWORD=docker \
-e POSTGRES_USER=docker \
-e POSTGRES_DB=docker \
--name postgres postgres:9.5-alpine
Build Demo Spring boot project
$ docker build -t spring_starter .
Run the container in the java_app_network
network
$ docker run --net=java_app_network -p 8080:8080 spring_starter
GET http://localhost:8080/api/v1/employees
POST http://localhost:8080/api/v1/employees
body_params { "name": "Alex", "age": 22 }
GET http://localhost:8080/api/v1/employees/1
DELETE http://localhost:8080/api/v1/employees/1
A postman collection has been added
For further reference, please consider the following sections: