Hello World sample shows how to deploy SpringBoot RESTful web service application with Docker and with Kubernetes
Optional:
Docker-Compose
Java 1.8 or 11.1
Maven 3.x
git clone https://github.com/dstar55/docker-hello-world-spring-boot .
docker build -t="hello-world-java" .
Maven build will be executes during creation of the docker image.
Note:if you run this command for first time it will take some time in order to download base image from DockerHub
docker run -p 8080:8080 -it --rm hello-world-java
curl localhost:8080
response should be:
Hello World
docker stop `docker container ls | grep "hello-world-java:*" | awk '{ print $1 }'`
Build and start the container by running
docker-compose up -d
curl localhost:8080
response should be:
Hello World
docker-compose down
Installed: MiniKube
Start minikube with command:
minikube start
kubectl create deployment hello-spring-boot --image=dstar55/docker-hello-world-spring-boot:latest
kubectl expose deployment hello-spring-boot --type=NodePort --port=8080
kubectl get service hello-spring-boot
response should something like:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-spring-boot NodePort xx.xx.xxx.xxx <none> 8080:xxxxx/TCP 59m
minikube service hello-spring-boot --url
response will be http..., e.g:
http://127.0.0.1:44963
curl 127.0.0.1:44963
response should be:
Hello World