Docker Cloud uses Docker Hub as its native registry for storing both public and private repositories. Once the images is pushed to Docker Hub, they are available in Docker Cloud. The Objective of the Docker application is to run java web application via docker image. Docker is a tool designed to make easier to create, deploy, and run applications by using containers.
Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. Docker provides a stand-alone Linux environment where you can install your libraries and run your application within an isolated environment. As we have installed application in AWS already, we should be able to install it into Docker.
Here the web application takes an input date and then gives weather forecast TMIN, TMAX for at least 5 days and these records are then populated in a table.
- Create Dynamic User Interface web application to consume REST API service.
- The Dynamic UI java web application includes HTML, CSS, Angular JS and executed it over apache tomcat 8.5.39 server on local machine.
- Then created an AWS linux EC2 instance. Connected to the instance and copied REST API application war file in the home directory of linux instance.Installed apache-tomcat-8.5.39 on the linux instance and finally placed my application war file in the webapps folder of apache tomcat.
- Next, in a web browser, typed the public DNS address (or the public IP address) of my instance with appending port 8080 and application-name to run my application on amazon linux instance EC2.
- Now, After running the application on tomcat server and testing it. After confirmation of it successfully running on tomcat. Shutted the tomcat server to open port 8080 to docker.
- install docker using sudo yum install -y docker
- start the docker service using sudo service docker start
- create a Dockerfile inside /usr/java/apache-tomcat/webapps/
- Write the following commands in that Pull base image From tomcat8:-jre8 Maintainer MAINTAINER "Sumit Ghewade <[email protected]"> Copy to images tomcat path ADD Rest_proj.war /usr/local/tomcat/webapps/
- Build docker image using docker build -t webserver .
- run docker containeer using docker build -it --rm -p 8080:8080 --name Rest_proj webserver
- use this link http://localhost:8080/Rest_proj/ to access project.
- we use "docker images" command to check all the docker image files.
- we use "docker ps" to check all the running containers. 10.use "docker commit 8f6d386f397d ghewadesumit/8f6d386f397d" command to commit our image file to our docker hub account.
- docker login --username --password to log in into docker.hub account.
- We then use "docker push ghewadesumit/8f6d386f397d" command to push our docker file to docker hub.
- To pull the docker image file on any device, use command "docker pull ghewadesumit/8f6d386f397d:latest".
Run the docker image You can run the image by using command "docker run -p 8080:8080 ghewadesumit/8f6d386f397d"
Use the following link to run on the local machine http://localhost:8080/Rest_proj/
Internet connection Prior Knowledge of AWS and Docker.
https://www.youtube.com/watch?v=_d-c9uGcUrU
https://github.uc.edu/tatavag/CloudComputing2019/wiki/Docker---Hands-on
http://codeomitted.com/deploy-war-file-to-docker-image/
- Sumit Ghewade - Initial work - ghewadesumit