SlideShare a Scribd company logo
Deployment of a Java Microservices Spring
Boot project on Docker, by pulling the image
from the DockerHub – Hands-on Case Study.
Mr. Subramanyam Tirumani Vemala
subramanyam.vemala@capgemini.com
Information:
This document contains the detailed steps with screenshots, to setup a Java Microservices project
using Spring Boot, generate jar, generate local docker image and its deployment.
Also contains pulling the docker image from the DockerHub and the deployment of the same.
Target Audience:
All, with knowledge of Java or coding and Containerization.
Artifacts needed:
1. JDK11
2. Eclipse – IDE
3. Docker Desktop installation.
4. Docker Hub Repository (Create an account repository on https://hub.docker.com/) -
5. Internet
Phases of project Implementation and
deployment steps:
A. Microservices project Implementation and deployment steps.
B. Docker deployment steps.
C. DockerHub deployment steps.
Part-A
Microservices project Implementation and
deployment steps
A. Microservices project Implementation and
deployment steps:
1. Create a Spring Starter Project.
2. Add all the necessary classes and dependencies in the pom.xml
3. Run as Spring Boot App on the Eclipse. Check for the output both
on the Console and the Browser.
4. Create the jar in the target folder, through maven install.
5. Check for the expected output on the Browser.
File – New – Spring Starter Project - Create
Provide the project details:
Choose the dependencies - Actuator:
Choose the dependencies - DevTools:
Choose the dependencies – Spring Web:
Project is created (subbu-case-study):
pom.xml – Deployment descriptor
Give the jar name in the pom.xml:
Create Controller with GetMapping and
RestController:
Create Dockerfile:
JRE System Library:
Maven Dependencies:
Run as a Spring Boot App:
Tomcat started successfully and message can
be seen on Console:
Run as Maven Install to create jar:
Jar is created in the Target folder:
http://localhost:8080
http://127.0.0.1:8080/message
http://localhost:8080/message
Stop the application:
Application is stopped:
Check for the output on the browser - Now no output, on the
browser as the application is stopped:
http://localhost:8080/message
Part-B
Docker - Implementation and deployment
steps
B. Docker deployment steps:
Docker deployment steps:
1. Create the jar in the target folder – as explained in the above Part-
A.
2. Install the Docker Desktop and make sure like it is up and running.
3. Create Dockerfile.
4. Create docker image using Dockerfile through build command.
5. Run the docker image. Map an external to the images internal port.
6. Check the output on the browser, with the appropriate mapping
URL.
Shows the successfully installed Docker
Desktop:
Click on Settings, and make sure that Docker
is running:
C:Userssvemalaeclipse-workspacesubbu-
case-study
Launch Power Shell – goto the Dockerfile
folder:
View of list of docker images before our
image is created:
“docker images” – command:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB
<none> <none> 54538fc8948d 28 hours ago 646MB
microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB
<none> <none> e41c35024224 2 days ago 636MB
<none> <none> bfc7ead597e5 2 days ago 636MB
openjdk 11 455ecea6f4f2 2 days ago 627MB
docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB
docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB
docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB
k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB
k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB
k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB
k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB
docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB
docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB
docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB
k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB
k8s.gcr.io/kube-proxy v1.14.6 ed8adf767eeb 12 months ago 82.1MB
k8s.gcr.io/kube-apiserver v1.14.6 0e422c9884cf 12 months ago 209MB
Build the Docker image using the Dockerfile using
the command: docker build –t <jar name> .
“docker build -t subbu-casestudy-microservices-
docker-dockerhub.jar” – command:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker build -t subbu-casestudy-microservices-docker-dockerhub.jar .
Sending build context to Docker daemon 28.15MB
Step 1/4 : FROM openjdk:11
---> 455ecea6f4f2
Step 2/4 : EXPOSE 8080
---> Using cache
---> 6ede0b7d669c
Step 3/4 : ADD target/subbu-casestudy-microservices-docker-dockerhub.jar subbu-casestudy-microservices-docker-dockerhub.jar
---> c8f0306d960e
Step 4/4 : ENTRYPOINT ["java", "-jar", "/subbu-casestudy-microservices-docker-dockerhub.jar"]
---> Running in d051c8501378
Removing intermediate container d051c8501378
---> ca813a46d63d
Successfully built ca813a46d63d
Successfully tagged subbu-casestudy-microservices-docker-dockerhub.jar:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x'
permissions. It is recommended to double check and reset permissions for sensitive files and directories.
New local docker image created:
subbu-casestudy-microservices-docker-dockerhub.jar latest
ca813a46d63d About a minute ago 646MB
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
subbu-casestudy-microservices-docker-dockerhub.jar latest ca813a46d63d About a minute ago 646MB
subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB
<none> <none> 54538fc8948d 28 hours ago 646MB
microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB
<none> <none> e41c35024224 2 days ago 636MB
<none> <none> bfc7ead597e5 2 days ago 636MB
openjdk 11 455ecea6f4f2 2 days ago 627MB
docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB
docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB
docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB
k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB
k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB
k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB
k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB
docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB
docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB
docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB
k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB
k8s.gcr.io/kube-proxy v1.14.6 ed8adf767eeb 12 months ago 82.1MB
k8s.gcr.io/kube-apiserver v1.14.6 0e422c9884cf 12 months ago 209MB
k8s.gcr.io/kube-scheduler v1.14.6 d27987bc993e 12 months ago 81.6MB
k8s.gcr.io/kube-controller-manager v1.14.6 4bb274b1f2c3 12 months ago 157MB
k8s.gcr.io/coredns 1.6.2 bf261d157914 12 months ago 44.1MB
Running containers by default:
“docker ps” - command only shows running
containers by default.
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ba4431a5c2fa subbu-casestudy-microservices-docker.jar "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9091->8080/tcp crazy_meninsky
ac9a3d272039 54538fc8948d "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9090->8080/tcp boring_heisenberg
867a94ed25e3 e704287ce753 "/storage-provisione…" 2 days ago Up 2 days k8s_storage-provisioner_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a-
1e673e45ebba_1
96ea327e35eb 129151cdf35f "/compose-controller…" 2 days ago Up 2 days k8s_compose_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0
149fdc1a31b3 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0
f205cecb47c7 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0
bbb644f85e92 989749268895 "/api-server --kubec…" 2 days ago Up 2 days k8s_compose_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0
2521e3c928dd 79da37e5a3aa "/kube-vpnkit-forwar…" 2 days ago Up 2 days k8s_vpnkit-controller_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0
90c864b57709 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0
cb2cc7d18486 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0
f7aeb917f72b k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0
174ffbf30737 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0
c8cf83b6bf5c 0ee1b8a3ebe0 "/usr/local/bin/kube…" 2 days ago Up 2 days k8s_kube-proxy_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0
7a7e9c6bc221 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0
Run the Docker image using the command: docker run –p <port number mapped
to the exposed port>:<Exposed port> <jar name>: Here external port 9092 is
mapped to the exposed containers internal port 8080:
“docker run -p 9092:8080 subbu-casestudy-
microservices-docker-dockerhub.jar” – command:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker run -p 9092:8080 subbu-casestudy-microservices-docker-dockerhub.jar
. ____ _ __ _ _
/ / ___'_ __ _ _(_)_ __ __ _    
( ( )___ | '_ | '_| | '_ / _` |    
/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.3.RELEASE)
2020-09-03 09:29:18.381 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Starting SubbuCaseStudyApplication v0.0.1-SNAPSHOT on e723271c4b10 with PID 1 (/subbu-casestudy-microservices-docker-dockerhub.jar started by root in /)
2020-09-03 09:29:18.387 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : No active profile set, falling back to default profiles: default
2020-09-03 09:29:21.610 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-09-03 09:29:21.652 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-09-03 09:29:21.653 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-03 09:29:21.849 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-09-03 09:29:21.851 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3162 ms
2020-09-03 09:29:22.752 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-03 09:29:23.283 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-09-03 09:29:23.422 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-09-03 09:29:23.466 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Started SubbuCaseStudyApplication in 6.691 seconds (JVM running for 8.016)
Welcome to Subbu - this message will appear in the Console
Check for the output on the browser – append the tag
“message”, as it is mapped in the Java Controller:
http://localhost:9092/message
Docker images, after ran with “docker run” –
now container is created:
“docker images” – command ran after
“docker run”:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
subbu-casestudy-microservices-docker-dockerhub.jar latest ca813a46d63d 16 minutes ago 646MB
subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB
<none> <none> 54538fc8948d 28 hours ago 646MB
microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB
<none> <none> e41c35024224 2 days ago 636MB
<none> <none> bfc7ead597e5 2 days ago 636MB
openjdk 11 455ecea6f4f2 2 days ago 627MB
docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB
docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB
docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB
k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB
k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB
k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB
k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB
docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB
docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB
docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB
k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB
Docker ps, after docker run – now container is
created:
“docker ps”, command after ran with “docker
run”:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e723271c4b10 subbu-casestudy-microservices-docker-dockerhub.jar "java -jar /subbu-ca…" 10 minutes ago Up 10 minutes 0.0.0.0:9092->8080/tcp hopeful_cerf
ba4431a5c2fa subbu-casestudy-microservices-docker.jar "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9091->8080/tcp crazy_meninsky
ac9a3d272039 54538fc8948d "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9090->8080/tcp boring_heisenberg
867a94ed25e3 e704287ce753 "/storage-provisione…" 2 days ago Up 2 days k8s_storage-provisioner_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a-1e673e45ebba_1
96ea327e35eb 129151cdf35f "/compose-controller…" 2 days ago Up 2 days k8s_compose_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0
149fdc1a31b3 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0
f205cecb47c7 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0
bbb644f85e92 989749268895 "/api-server --kubec…" 2 days ago Up 2 days k8s_compose_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0
2521e3c928dd 79da37e5a3aa "/kube-vpnkit-forwar…" 2 days ago Up 2 days k8s_vpnkit-controller_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0
90c864b57709 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0
cb2cc7d18486 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0
f7aeb917f72b k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0
174ffbf30737 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0
c8cf83b6bf5c 0ee1b8a3ebe0 "/usr/local/bin/kube…" 2 days ago Up 2 days k8s_kube-proxy_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0
7a7e9c6bc221 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0
81982e6ea504 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a-1e673e45ebba_0
62ef55945511 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0
41779161b3af b2756210eeab "etcd --advertise-cl…" 2 days ago Up 2 days k8s_etcd_etcd-docker-desktop_kube-system_bc3eca0122540ccc59e959a7805e87e8_0
Part-C
Docker Hub - Implementation and
Deployment steps
C. DockerHub deployment steps:
Docker Hub deployment steps:
1. Create an account in the https://hub.docker.com/
2. Validate your email, which enables you to create a repository in the
DockerHub.
3. Push the local docker image to the DockerHub repository.
4. Stop the local application and remove all the local images.
5. Now run the docker image, choosing the DockerHub image. Docker
pulls the image from the DockerHub, as it will not find it locally.
6. Check the output on the browser, with the appropriate mapping
URL.
Docker Hub, logged-in view.
“docker login”- command: Login with your Docker ID to push
and pull images from Docker Hub. If you don't have a Docker
ID, head over to https://hub.docker.com to create one.
Tag the docker image:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker tag
subbu-casestudy-microservices-docker-dockerhub.jar
subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar
PS C:Userssvemalaeclipse-workspacesubbu-case-study>
Generalized command will be, “docker tag <local image name>
<registered DockerHub userid>/<name of image used to have on
DockerHub>”
“docker tag subbu-casestudy-microservices-docker-dockerhub.jar
subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar
” – command executed, local image is tagged:
Push the docker images into DockerHub
subbudockerhub: Command – “docker push <tagged
name of the image>”
Command - “docker push subbudockerhub/subbu-
casestudy-microservices-docker-dockerhub.jar”
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker push subbudockerhub/subbu-casestudy-
microservices-docker-dockerhub.jar
The push refers to repository [docker.io/subbudockerhub/subbu-casestudy-microservices-docker-
dockerhub.jar]
e87e5457167a: Pushed
beec189e63c5: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
03ae48cd6c8d: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
de9aadc6b492: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
e5df62d9b33a: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
7a9460d53218: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
b2765ac0333a: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
0ced13fcf944: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar
latest: digest: sha256:a96fc0c8a1cc09a7391e0e659e062cf64dec43a45fa94b4ea9a64c5412862da5 size: 2006
PS C:Userssvemalaeclipse-workspacesubbu-case-study>
docker image “subbu-casestudy-microservices-docker-
dockerhub.jar”, is pushed into the DockerHub:
“docker images” – command, for listing all the
images:
“docker ps” – command, to list the active
containers:
Detailed steps for Testing for the Docker Hub:
1. Login to Docker Hub.
2. Tag the local image.
3. Push the local image into the Docker Hub.
4. Test the application by pulling the image from the Docker Hub:
• Make sure like, no local images (subbu-casestudy-microservices-docker-dockerhub.jar
and subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar) of your
application. Delete all local and tagged images.
• Make sure like, no local application on Eclipse or tomcat is running.
• Run the command: “docker run –p 9092:8080 subbudockerhub/subbu-casestudy-
microservices-docker-dockerhub.jar”
• As there is no local image by the name, subbudockerhub/subbu-casestudy-
microservices-docker-dockerhub.jar, it pulls from the public DockerHub subbudockerhub
• Check the output on the browser.
Stop the Tomcat on Eclipse if it is running,
before we test for the DockerHub image:
“ping 8080” command – make sure like local
application on Eclipse is not running:
Check for the location application on the browser:
http://localhost:8080/message
Currently we can see a local image
“subbudockerhub/subbu-casestudy-microservices-
docker-dockerhub.jar”:
Execute this command to delete the local images, “docker rmi -
f subbudockerhub/subbu-casestudy-microservices-docker-
dockerhub.jar”:
Now there are no local “subbudockerhub/subbu-
casestudy-microservices-docker-dockerhub.jar” images:
Run the command: “docker run –p 9092:8080 subbudockerhub/subbu-casestudy-microservices-
docker-dockerhub.jar”
As there is no local image by the name, subbudockerhub/subbu-casestudy-microservices-docker-
dockerhub.jar, it pulls from the public DockerHub subbudockerhub:
“docker run -p 9092:8080 subbudockerhub/subbu-
casestudy-microservices-docker-dockerhub.jar”
command:
PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker run -p 9092:8080 subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar
Unable to find image 'subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar:latest' locally
latest: Pulling from subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar
Digest: sha256:a96fc0c8a1cc09a7391e0e659e062cf64dec43a45fa94b4ea9a64c5412862da5
Status: Downloaded newer image for subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar:latest
. ____ _ __ _ _
/ / ___'_ __ _ _(_)_ __ __ _    
( ( )___ | '_ | '_| | '_ / _` |    
/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.3.RELEASE)
2020-09-04 05:31:32.919 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Starting SubbuCaseStudyApplication v0.0.1-SNAPSHOT on 8ce9b5baff80 with PID 1 (/subbu-casestudy-microservices-docker-dockerhub.jar started by root in /)
2020-09-04 05:31:32.935 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : No active profile set, falling back to default profiles: default
2020-09-04 05:31:35.332 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-09-04 05:31:35.353 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-09-04 05:31:35.354 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-04 05:31:35.477 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-09-04 05:31:35.477 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2399 ms
2020-09-04 05:31:36.029 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-04 05:31:36.471 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-09-04 05:31:36.555 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
Output on the port 9092:
http://localhost:9092/message
Again docker, keeps the local image, once it
pulls for the executed deployment:
Generalized commands used:
docker rmi <image>
docker rmi –f <image>
docker rm <container>
docker rm –f <container>
docker images
docker ps
docker build –t <jar name> .
docker run –p 9092:8080 <image>
Kill the tasks if the port has been used by
other services - optional:
Kill the tasks if the port has been used by
other services - optional:
C:Userssvemala>netstat -ano | findstr :9080
TCP 0.0.0.0:9080 0.0.0.0:0 LISTENING 31576
TCP [::]:9080 [::]:0 LISTENING 31576
C:Userssvemala>taskkill /PID 31576 /F
SUCCESS: The process with PID 31576 has been terminated.
C:Userssvemala>
C:Userssvemalaeclipse-workspacesubbu-
case-study
Appendix:
Download the code from public GitGub:
1. HTTPS:
https://github.com/subbugh/java-microservices-springboot-docker-
dockerhub.git
2. SSH:
git@github.com:subbugh/java-microservices-springboot-docker-
dockerhub.git
3. Code Zip file:
4. Detailed Logs:
Ad

Recommended

Simply your Jenkins Projects with Docker Multi-Stage Builds
Simply your Jenkins Projects with Docker Multi-Stage Builds
Eric Smalling
 
Dockerfiles building docker images automatically v (workdir, env, add, and ...
Dockerfiles building docker images automatically v (workdir, env, add, and ...
ansonjonel
 
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Docker, Inc.
 
How to Dockerize Web Application using Docker Compose
How to Dockerize Web Application using Docker Compose
Evoke Technologies
 
Jenkins, pipeline and docker
Jenkins, pipeline and docker
AgileDenver
 
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Mihai Criveti
 
Continuous Integration using Docker & Jenkins
Continuous Integration using Docker & Jenkins
B1 Systems GmbH
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
DockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
Tibor Vass
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Eric Smalling
 
DCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best Practices
Docker, Inc.
 
Docker by Example - Basics
Docker by Example - Basics
CodeOps Technologies LLP
 
Ansible Workshop for Pythonistas
Ansible Workshop for Pythonistas
Mihai Criveti
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
Binary Studio
 
Novices guide to docker
Novices guide to docker
Alec Clews
 
Baking docker using chef
Baking docker using chef
Mukta Aphale
 
Docker
Docker
Chen Chun
 
Dockerfile
Dockerfile
Jeffrey Ellin
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
Jules Pierre-Louis
 
Streamline your development environment with docker
Streamline your development environment with docker
Giacomo Bagnoli
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
Introducing Docker
Introducing Docker
Francesco Pantano
 
Simple Build Tool
Simple Build Tool
David Galichet
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
Steffen Gebert
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.
Subramanyam Vemala
 
Docker and Microservice
Docker and Microservice
Samuel Chow
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
Arun Gupta
 

More Related Content

What's hot (19)

DockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
Tibor Vass
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Eric Smalling
 
DCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best Practices
Docker, Inc.
 
Docker by Example - Basics
Docker by Example - Basics
CodeOps Technologies LLP
 
Ansible Workshop for Pythonistas
Ansible Workshop for Pythonistas
Mihai Criveti
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
Binary Studio
 
Novices guide to docker
Novices guide to docker
Alec Clews
 
Baking docker using chef
Baking docker using chef
Mukta Aphale
 
Docker
Docker
Chen Chun
 
Dockerfile
Dockerfile
Jeffrey Ellin
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
Jules Pierre-Louis
 
Streamline your development environment with docker
Streamline your development environment with docker
Giacomo Bagnoli
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
Introducing Docker
Introducing Docker
Francesco Pantano
 
Simple Build Tool
Simple Build Tool
David Galichet
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
Steffen Gebert
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
DockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
Tibor Vass
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Eric Smalling
 
DCEU 18: Dockerfile Best Practices
DCEU 18: Dockerfile Best Practices
Docker, Inc.
 
Ansible Workshop for Pythonistas
Ansible Workshop for Pythonistas
Mihai Criveti
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Lucas Jellema
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
Binary Studio
 
Novices guide to docker
Novices guide to docker
Alec Clews
 
Baking docker using chef
Baking docker using chef
Mukta Aphale
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
Jules Pierre-Louis
 
Streamline your development environment with docker
Streamline your development environment with docker
Giacomo Bagnoli
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
Steffen Gebert
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 

Similar to Java microservicesdockerdockerhubusecase2 (20)

A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.
Subramanyam Vemala
 
Docker and Microservice
Docker and Microservice
Samuel Chow
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
Arun Gupta
 
Unleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket Cloud
Atlassian
 
Best Practices for Developing & Deploying Java Applications with Docker
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
BBL Premiers pas avec Docker
BBL Premiers pas avec Docker
kanedafromparis
 
Docker+java
Docker+java
DPC Consulting Ltd
 
Package your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and Kubernetes
Arun Gupta
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
DCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best Practices
Docker, Inc.
 
Faster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker Platform
msyukor
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
양재동 코드랩
 
Docker - From Walking To Running
Docker - From Walking To Running
Giacomo Vacca
 
Разработка cloud-native Java-приложений для Kubernetes, Егор Волков,Senior Ja...
Разработка cloud-native Java-приложений для Kubernetes, Егор Волков,Senior Ja...
DataArt
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
Containerize spring boot application with docker
Containerize spring boot application with docker
Sunil kumar Mohanty
 
Docker From Scratch
Docker From Scratch
Giacomo Vacca
 
Rakuten Ichiba development Automation show case - Bamboo, Docker -
Rakuten Ichiba development Automation show case - Bamboo, Docker -
Rakuten Group, Inc.
 
Docker for Java Developers
Docker for Java Developers
Imesh Gunaratne
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with Docker
Khôi Nguyễn Minh
 
A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.
Subramanyam Vemala
 
Docker and Microservice
Docker and Microservice
Samuel Chow
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
Arun Gupta
 
Unleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket Cloud
Atlassian
 
Best Practices for Developing & Deploying Java Applications with Docker
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
BBL Premiers pas avec Docker
BBL Premiers pas avec Docker
kanedafromparis
 
Package your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and Kubernetes
Arun Gupta
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
DCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best Practices
Docker, Inc.
 
Faster and Easier Software Development using Docker Platform
Faster and Easier Software Development using Docker Platform
msyukor
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
양재동 코드랩
 
Docker - From Walking To Running
Docker - From Walking To Running
Giacomo Vacca
 
Разработка cloud-native Java-приложений для Kubernetes, Егор Волков,Senior Ja...
Разработка cloud-native Java-приложений для Kubernetes, Егор Волков,Senior Ja...
DataArt
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
Containerize spring boot application with docker
Containerize spring boot application with docker
Sunil kumar Mohanty
 
Rakuten Ichiba development Automation show case - Bamboo, Docker -
Rakuten Ichiba development Automation show case - Bamboo, Docker -
Rakuten Group, Inc.
 
Docker for Java Developers
Docker for Java Developers
Imesh Gunaratne
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with Docker
Khôi Nguyễn Minh
 
Ad

More from Subramanyam Vemala (14)

Domain Driven Development (DDD)
Domain Driven Development (DDD)
Subramanyam Vemala
 
AWS Amazon Quantum Ledger Database (QLDB)
AWS Amazon Quantum Ledger Database (QLDB)
Subramanyam Vemala
 
Java microservicesspringbootcasestudy2
Java microservicesspringbootcasestudy2
Subramanyam Vemala
 
Aws centralized logs
Aws centralized logs
Subramanyam Vemala
 
AWS SNS - Notifications through SMS and Email
AWS SNS - Notifications through SMS and Email
Subramanyam Vemala
 
Creating AppStream users through User Pool
Creating AppStream users through User Pool
Subramanyam Vemala
 
Creating AppStream apps and configuring users with Domain Join.
Creating AppStream apps and configuring users with Domain Join.
Subramanyam Vemala
 
AWS CodeCommit – Securing the Repository and Branches
AWS CodeCommit – Securing the Repository and Branches
Subramanyam Vemala
 
AWS IAM User Setup for CodeCommit
AWS IAM User Setup for CodeCommit
Subramanyam Vemala
 
AWS CodeCommit Setup
AWS CodeCommit Setup
Subramanyam Vemala
 
Migration architecture on_prem
Migration architecture on_prem
Subramanyam Vemala
 
Aws managed microsoft ad
Aws managed microsoft ad
Subramanyam Vemala
 
AWS AD Connector - SSO - Directory Service - Cloud
AWS AD Connector - SSO - Directory Service - Cloud
Subramanyam Vemala
 
Aws over view_demoppt
Aws over view_demoppt
Subramanyam Vemala
 
Domain Driven Development (DDD)
Domain Driven Development (DDD)
Subramanyam Vemala
 
AWS Amazon Quantum Ledger Database (QLDB)
AWS Amazon Quantum Ledger Database (QLDB)
Subramanyam Vemala
 
Java microservicesspringbootcasestudy2
Java microservicesspringbootcasestudy2
Subramanyam Vemala
 
AWS SNS - Notifications through SMS and Email
AWS SNS - Notifications through SMS and Email
Subramanyam Vemala
 
Creating AppStream users through User Pool
Creating AppStream users through User Pool
Subramanyam Vemala
 
Creating AppStream apps and configuring users with Domain Join.
Creating AppStream apps and configuring users with Domain Join.
Subramanyam Vemala
 
AWS CodeCommit – Securing the Repository and Branches
AWS CodeCommit – Securing the Repository and Branches
Subramanyam Vemala
 
AWS IAM User Setup for CodeCommit
AWS IAM User Setup for CodeCommit
Subramanyam Vemala
 
Migration architecture on_prem
Migration architecture on_prem
Subramanyam Vemala
 
AWS AD Connector - SSO - Directory Service - Cloud
AWS AD Connector - SSO - Directory Service - Cloud
Subramanyam Vemala
 
Ad

Recently uploaded (20)

Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
IObit Driver Booster Pro 12 Crack Latest Version Download
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Canva Pro Crack Free Download 2025-FREE LATEST
Canva Pro Crack Free Download 2025-FREE LATEST
grete1122g
 
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
 
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
 
IObit Driver Booster Pro 12 Crack Latest Version Download
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
 
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
From Code to Commerce, a Backend Java Developer's Galactic Journey into Ecomm...
Jamie Coleman
 
Why Edge Computing Matters in Mobile Application Tech.pdf
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
 
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 

Java microservicesdockerdockerhubusecase2

  • 1. Deployment of a Java Microservices Spring Boot project on Docker, by pulling the image from the DockerHub – Hands-on Case Study. Mr. Subramanyam Tirumani Vemala [email protected]
  • 2. Information: This document contains the detailed steps with screenshots, to setup a Java Microservices project using Spring Boot, generate jar, generate local docker image and its deployment. Also contains pulling the docker image from the DockerHub and the deployment of the same. Target Audience: All, with knowledge of Java or coding and Containerization. Artifacts needed: 1. JDK11 2. Eclipse – IDE 3. Docker Desktop installation. 4. Docker Hub Repository (Create an account repository on https://hub.docker.com/) - 5. Internet
  • 3. Phases of project Implementation and deployment steps: A. Microservices project Implementation and deployment steps. B. Docker deployment steps. C. DockerHub deployment steps.
  • 5. A. Microservices project Implementation and deployment steps: 1. Create a Spring Starter Project. 2. Add all the necessary classes and dependencies in the pom.xml 3. Run as Spring Boot App on the Eclipse. Check for the output both on the Console and the Browser. 4. Create the jar in the target folder, through maven install. 5. Check for the expected output on the Browser.
  • 6. File – New – Spring Starter Project - Create
  • 10. Choose the dependencies – Spring Web:
  • 11. Project is created (subbu-case-study):
  • 13. Give the jar name in the pom.xml:
  • 14. Create Controller with GetMapping and RestController:
  • 18. Run as a Spring Boot App:
  • 19. Tomcat started successfully and message can be seen on Console:
  • 20. Run as Maven Install to create jar:
  • 21. Jar is created in the Target folder:
  • 27. Check for the output on the browser - Now no output, on the browser as the application is stopped: http://localhost:8080/message
  • 28. Part-B Docker - Implementation and deployment steps
  • 29. B. Docker deployment steps: Docker deployment steps: 1. Create the jar in the target folder – as explained in the above Part- A. 2. Install the Docker Desktop and make sure like it is up and running. 3. Create Dockerfile. 4. Create docker image using Dockerfile through build command. 5. Run the docker image. Map an external to the images internal port. 6. Check the output on the browser, with the appropriate mapping URL.
  • 30. Shows the successfully installed Docker Desktop:
  • 31. Click on Settings, and make sure that Docker is running:
  • 33. Launch Power Shell – goto the Dockerfile folder:
  • 34. View of list of docker images before our image is created:
  • 35. “docker images” – command: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images REPOSITORY TAG IMAGE ID CREATED SIZE subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB <none> <none> 54538fc8948d 28 hours ago 646MB microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB <none> <none> e41c35024224 2 days ago 636MB <none> <none> bfc7ead597e5 2 days ago 636MB openjdk 11 455ecea6f4f2 2 days ago 627MB docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB k8s.gcr.io/kube-proxy v1.14.6 ed8adf767eeb 12 months ago 82.1MB k8s.gcr.io/kube-apiserver v1.14.6 0e422c9884cf 12 months ago 209MB
  • 36. Build the Docker image using the Dockerfile using the command: docker build –t <jar name> .
  • 37. “docker build -t subbu-casestudy-microservices- docker-dockerhub.jar” – command: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker build -t subbu-casestudy-microservices-docker-dockerhub.jar . Sending build context to Docker daemon 28.15MB Step 1/4 : FROM openjdk:11 ---> 455ecea6f4f2 Step 2/4 : EXPOSE 8080 ---> Using cache ---> 6ede0b7d669c Step 3/4 : ADD target/subbu-casestudy-microservices-docker-dockerhub.jar subbu-casestudy-microservices-docker-dockerhub.jar ---> c8f0306d960e Step 4/4 : ENTRYPOINT ["java", "-jar", "/subbu-casestudy-microservices-docker-dockerhub.jar"] ---> Running in d051c8501378 Removing intermediate container d051c8501378 ---> ca813a46d63d Successfully built ca813a46d63d Successfully tagged subbu-casestudy-microservices-docker-dockerhub.jar:latest SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
  • 38. New local docker image created:
  • 39. subbu-casestudy-microservices-docker-dockerhub.jar latest ca813a46d63d About a minute ago 646MB PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images REPOSITORY TAG IMAGE ID CREATED SIZE subbu-casestudy-microservices-docker-dockerhub.jar latest ca813a46d63d About a minute ago 646MB subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB <none> <none> 54538fc8948d 28 hours ago 646MB microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB <none> <none> e41c35024224 2 days ago 636MB <none> <none> bfc7ead597e5 2 days ago 636MB openjdk 11 455ecea6f4f2 2 days ago 627MB docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB k8s.gcr.io/kube-proxy v1.14.6 ed8adf767eeb 12 months ago 82.1MB k8s.gcr.io/kube-apiserver v1.14.6 0e422c9884cf 12 months ago 209MB k8s.gcr.io/kube-scheduler v1.14.6 d27987bc993e 12 months ago 81.6MB k8s.gcr.io/kube-controller-manager v1.14.6 4bb274b1f2c3 12 months ago 157MB k8s.gcr.io/coredns 1.6.2 bf261d157914 12 months ago 44.1MB
  • 41. “docker ps” - command only shows running containers by default. PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ba4431a5c2fa subbu-casestudy-microservices-docker.jar "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9091->8080/tcp crazy_meninsky ac9a3d272039 54538fc8948d "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9090->8080/tcp boring_heisenberg 867a94ed25e3 e704287ce753 "/storage-provisione…" 2 days ago Up 2 days k8s_storage-provisioner_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a- 1e673e45ebba_1 96ea327e35eb 129151cdf35f "/compose-controller…" 2 days ago Up 2 days k8s_compose_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0 149fdc1a31b3 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0 f205cecb47c7 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0 bbb644f85e92 989749268895 "/api-server --kubec…" 2 days ago Up 2 days k8s_compose_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0 2521e3c928dd 79da37e5a3aa "/kube-vpnkit-forwar…" 2 days ago Up 2 days k8s_vpnkit-controller_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0 90c864b57709 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0 cb2cc7d18486 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0 f7aeb917f72b k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0 174ffbf30737 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0 c8cf83b6bf5c 0ee1b8a3ebe0 "/usr/local/bin/kube…" 2 days ago Up 2 days k8s_kube-proxy_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0 7a7e9c6bc221 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0
  • 42. Run the Docker image using the command: docker run –p <port number mapped to the exposed port>:<Exposed port> <jar name>: Here external port 9092 is mapped to the exposed containers internal port 8080:
  • 43. “docker run -p 9092:8080 subbu-casestudy- microservices-docker-dockerhub.jar” – command: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker run -p 9092:8080 subbu-casestudy-microservices-docker-dockerhub.jar . ____ _ __ _ _ / / ___'_ __ _ _(_)_ __ __ _ ( ( )___ | '_ | '_| | '_ / _` | / ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |___, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.3.RELEASE) 2020-09-03 09:29:18.381 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Starting SubbuCaseStudyApplication v0.0.1-SNAPSHOT on e723271c4b10 with PID 1 (/subbu-casestudy-microservices-docker-dockerhub.jar started by root in /) 2020-09-03 09:29:18.387 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : No active profile set, falling back to default profiles: default 2020-09-03 09:29:21.610 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-09-03 09:29:21.652 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-09-03 09:29:21.653 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] 2020-09-03 09:29:21.849 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-09-03 09:29:21.851 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3162 ms 2020-09-03 09:29:22.752 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-09-03 09:29:23.283 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2020-09-03 09:29:23.422 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2020-09-03 09:29:23.466 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Started SubbuCaseStudyApplication in 6.691 seconds (JVM running for 8.016) Welcome to Subbu - this message will appear in the Console
  • 44. Check for the output on the browser – append the tag “message”, as it is mapped in the Java Controller: http://localhost:9092/message
  • 45. Docker images, after ran with “docker run” – now container is created:
  • 46. “docker images” – command ran after “docker run”: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker images REPOSITORY TAG IMAGE ID CREATED SIZE subbu-casestudy-microservices-docker-dockerhub.jar latest ca813a46d63d 16 minutes ago 646MB subbu-casestudy-microservices-docker.jar latest e7554d59f74b 28 hours ago 646MB <none> <none> 54538fc8948d 28 hours ago 646MB microservicesdockerjar3.jar latest 2eb634581cbb 2 days ago 636MB <none> <none> e41c35024224 2 days ago 636MB <none> <none> bfc7ead597e5 2 days ago 636MB openjdk 11 455ecea6f4f2 2 days ago 627MB docker/desktop-storage-provisioner v1.1 e704287ce753 5 months ago 41.8MB docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 6 months ago 36.6MB docker/desktop-kubernetes kubernetes-v1.16.5-cni-v0.7.5-critools-v1.15.0 a86647f0b376 7 months ago 279MB k8s.gcr.io/kube-controller-manager v1.16.5 441835dd2301 7 months ago 151MB k8s.gcr.io/kube-proxy v1.16.5 0ee1b8a3ebe0 7 months ago 82.7MB k8s.gcr.io/kube-apiserver v1.16.5 fc838b21afbb 7 months ago 159MB k8s.gcr.io/kube-scheduler v1.16.5 b4d073a9efda 7 months ago 83.5MB docker/kube-compose-controller v0.4.25-alpha1 129151cdf35f 10 months ago 35.6MB docker/kube-compose-api-server v0.4.25-alpha1 989749268895 10 months ago 50.7MB docker/kube-compose-installer v0.4.25-alpha1 2a71ac5a1359 10 months ago 42.3MB k8s.gcr.io/etcd 3.3.15-0 b2756210eeab 12 months ago 247MB
  • 47. Docker ps, after docker run – now container is created:
  • 48. “docker ps”, command after ran with “docker run”: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e723271c4b10 subbu-casestudy-microservices-docker-dockerhub.jar "java -jar /subbu-ca…" 10 minutes ago Up 10 minutes 0.0.0.0:9092->8080/tcp hopeful_cerf ba4431a5c2fa subbu-casestudy-microservices-docker.jar "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9091->8080/tcp crazy_meninsky ac9a3d272039 54538fc8948d "java -jar /subbu-ca…" 28 hours ago Up 28 hours 0.0.0.0:9090->8080/tcp boring_heisenberg 867a94ed25e3 e704287ce753 "/storage-provisione…" 2 days ago Up 2 days k8s_storage-provisioner_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a-1e673e45ebba_1 96ea327e35eb 129151cdf35f "/compose-controller…" 2 days ago Up 2 days k8s_compose_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0 149fdc1a31b3 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0 f205cecb47c7 bf261d157914 "/coredns -conf /etc…" 2 days ago Up 2 days k8s_coredns_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0 bbb644f85e92 989749268895 "/api-server --kubec…" 2 days ago Up 2 days k8s_compose_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0 2521e3c928dd 79da37e5a3aa "/kube-vpnkit-forwar…" 2 days ago Up 2 days k8s_vpnkit-controller_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0 90c864b57709 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-78f95d4f8c-j4lhk_docker_e5bb9b12-338d-4f4e-99a0-973ece0f631d_0 cb2cc7d18486 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_compose-api-6ffb89dc58-96w7k_docker_faed47b7-753f-4acf-a61f-b4e6976c97d3_0 f7aeb917f72b k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-zv6m4_kube-system_48269134-3fbc-4a5c-8f10-f671e07917cd_0 174ffbf30737 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_coredns-5644d7b6d9-85fz6_kube-system_8da76ca1-bc13-4a95-90ac-330cad6f6d20_0 c8cf83b6bf5c 0ee1b8a3ebe0 "/usr/local/bin/kube…" 2 days ago Up 2 days k8s_kube-proxy_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0 7a7e9c6bc221 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_vpnkit-controller_kube-system_a9ab932e-b5df-4426-8ed5-478bf96302ba_0 81982e6ea504 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_storage-provisioner_kube-system_cf41569a-33ac-4693-be2a-1e673e45ebba_0 62ef55945511 k8s.gcr.io/pause:3.1 "/pause" 2 days ago Up 2 days k8s_POD_kube-proxy-g4v94_kube-system_69795b23-d199-4265-8998-a24f3aaf69b4_0 41779161b3af b2756210eeab "etcd --advertise-cl…" 2 days ago Up 2 days k8s_etcd_etcd-docker-desktop_kube-system_bc3eca0122540ccc59e959a7805e87e8_0
  • 49. Part-C Docker Hub - Implementation and Deployment steps
  • 50. C. DockerHub deployment steps: Docker Hub deployment steps: 1. Create an account in the https://hub.docker.com/ 2. Validate your email, which enables you to create a repository in the DockerHub. 3. Push the local docker image to the DockerHub repository. 4. Stop the local application and remove all the local images. 5. Now run the docker image, choosing the DockerHub image. Docker pulls the image from the DockerHub, as it will not find it locally. 6. Check the output on the browser, with the appropriate mapping URL.
  • 52. “docker login”- command: Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
  • 53. Tag the docker image: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker tag subbu-casestudy-microservices-docker-dockerhub.jar subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar PS C:Userssvemalaeclipse-workspacesubbu-case-study> Generalized command will be, “docker tag <local image name> <registered DockerHub userid>/<name of image used to have on DockerHub>”
  • 55. Push the docker images into DockerHub subbudockerhub: Command – “docker push <tagged name of the image>”
  • 56. Command - “docker push subbudockerhub/subbu- casestudy-microservices-docker-dockerhub.jar” PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker push subbudockerhub/subbu-casestudy- microservices-docker-dockerhub.jar The push refers to repository [docker.io/subbudockerhub/subbu-casestudy-microservices-docker- dockerhub.jar] e87e5457167a: Pushed beec189e63c5: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar 03ae48cd6c8d: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar de9aadc6b492: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar e5df62d9b33a: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar 7a9460d53218: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar b2765ac0333a: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar 0ced13fcf944: Mounted from subbudockerhub/subbu-casestudy-microservices-docker.jar latest: digest: sha256:a96fc0c8a1cc09a7391e0e659e062cf64dec43a45fa94b4ea9a64c5412862da5 size: 2006 PS C:Userssvemalaeclipse-workspacesubbu-case-study>
  • 58. “docker images” – command, for listing all the images:
  • 59. “docker ps” – command, to list the active containers:
  • 60. Detailed steps for Testing for the Docker Hub: 1. Login to Docker Hub. 2. Tag the local image. 3. Push the local image into the Docker Hub. 4. Test the application by pulling the image from the Docker Hub: • Make sure like, no local images (subbu-casestudy-microservices-docker-dockerhub.jar and subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar) of your application. Delete all local and tagged images. • Make sure like, no local application on Eclipse or tomcat is running. • Run the command: “docker run –p 9092:8080 subbudockerhub/subbu-casestudy- microservices-docker-dockerhub.jar” • As there is no local image by the name, subbudockerhub/subbu-casestudy- microservices-docker-dockerhub.jar, it pulls from the public DockerHub subbudockerhub • Check the output on the browser.
  • 61. Stop the Tomcat on Eclipse if it is running, before we test for the DockerHub image:
  • 62. “ping 8080” command – make sure like local application on Eclipse is not running:
  • 63. Check for the location application on the browser: http://localhost:8080/message
  • 64. Currently we can see a local image “subbudockerhub/subbu-casestudy-microservices- docker-dockerhub.jar”:
  • 65. Execute this command to delete the local images, “docker rmi - f subbudockerhub/subbu-casestudy-microservices-docker- dockerhub.jar”:
  • 66. Now there are no local “subbudockerhub/subbu- casestudy-microservices-docker-dockerhub.jar” images:
  • 67. Run the command: “docker run –p 9092:8080 subbudockerhub/subbu-casestudy-microservices- docker-dockerhub.jar” As there is no local image by the name, subbudockerhub/subbu-casestudy-microservices-docker- dockerhub.jar, it pulls from the public DockerHub subbudockerhub:
  • 68. “docker run -p 9092:8080 subbudockerhub/subbu- casestudy-microservices-docker-dockerhub.jar” command: PS C:Userssvemalaeclipse-workspacesubbu-case-study> docker run -p 9092:8080 subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar Unable to find image 'subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar:latest' locally latest: Pulling from subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar Digest: sha256:a96fc0c8a1cc09a7391e0e659e062cf64dec43a45fa94b4ea9a64c5412862da5 Status: Downloaded newer image for subbudockerhub/subbu-casestudy-microservices-docker-dockerhub.jar:latest . ____ _ __ _ _ / / ___'_ __ _ _(_)_ __ __ _ ( ( )___ | '_ | '_| | '_ / _` | / ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |___, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.3.RELEASE) 2020-09-04 05:31:32.919 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : Starting SubbuCaseStudyApplication v0.0.1-SNAPSHOT on 8ce9b5baff80 with PID 1 (/subbu-casestudy-microservices-docker-dockerhub.jar started by root in /) 2020-09-04 05:31:32.935 INFO 1 --- [ main] com.subbu.SubbuCaseStudyApplication : No active profile set, falling back to default profiles: default 2020-09-04 05:31:35.332 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-09-04 05:31:35.353 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-09-04 05:31:35.354 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] 2020-09-04 05:31:35.477 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-09-04 05:31:35.477 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2399 ms 2020-09-04 05:31:36.029 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-09-04 05:31:36.471 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2020-09-04 05:31:36.555 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
  • 69. Output on the port 9092: http://localhost:9092/message
  • 70. Again docker, keeps the local image, once it pulls for the executed deployment:
  • 71. Generalized commands used: docker rmi <image> docker rmi –f <image> docker rm <container> docker rm –f <container> docker images docker ps docker build –t <jar name> . docker run –p 9092:8080 <image>
  • 72. Kill the tasks if the port has been used by other services - optional:
  • 73. Kill the tasks if the port has been used by other services - optional: C:Userssvemala>netstat -ano | findstr :9080 TCP 0.0.0.0:9080 0.0.0.0:0 LISTENING 31576 TCP [::]:9080 [::]:0 LISTENING 31576 C:Userssvemala>taskkill /PID 31576 /F SUCCESS: The process with PID 31576 has been terminated. C:Userssvemala>
  • 75. Appendix: Download the code from public GitGub: 1. HTTPS: https://github.com/subbugh/java-microservices-springboot-docker- dockerhub.git 2. SSH: [email protected]:subbugh/java-microservices-springboot-docker- dockerhub.git 3. Code Zip file: 4. Detailed Logs: