To build the project just run
./gradlew build
./gradlew docker
docker images
Visweshwar-Ganeshs-MacBook-Pro:springboot visweshwarganesh$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
com.vis/springboot latest 78f1354a2fb4 2 weeks ago 119 MB
docker run -p 8080:8080 -t com.vis/springboot
You can validate this against localhost:8080
Hello Docker World
Now we need a repository to push this into. We can use Pivotal/AWS/Google containers.
Let's use google container.
Create a project in Google cloud through console or command line. I just chose google Console
This is to get command line access to gcloud
Enable 2 APIs
Container Registry API
Kubernetes Engine API
##Push the docker Image to Google Cloud Container Registry First Create a tag
docker tag <user-name>/<sample-image-name> gcr.io/<project-id>/<sample-image-name>:<tag>
docker tag vis.com/springboot-docker gcr.io/springboot-docker/springboot
https://cloud.google.com/container-registry/docs/advanced-authentication
gcloud components install docker-credential-gcr
docker-credential-gcr configure-docker
Push the image
docker — push gcr.io/your-project-id/<project-id>/<sample-image-name>:<tag>
docker push gcr.io/springboot-docker/springboot
https://cloud.google.com/kubernetes-engine/docs/quickstart
onetime. gcloud components install kubectl
1.Set project ID
gcloud config set project PROJECT_ID
The project ID is available in the console
2.Set Compute Zone
gcloud config set compute/zone COMPUTE_ZONE
ex; us-west1-a
3.Create Clusters
cloud container clusters create springboot-cluster --num-nodes=3
- Expose Port
kubectl run spring-server --image gcr.io/springboot-docker/springboot --port 8080
kubectl expose deployment spring-server --type LoadBalancer --port 80 --target-port 8080
- Get IP Address
kubectl get service spring-server