Deploying Application on Docker Container

Step1:- Create two EC2 instances, one for the docker server and the other one is for the Jenkins server

Step2:- Docker Server --> Install docker and start the service of docker

Step3:- Create one user and set a password for the same

Step4:- Pull the image from the docker hub

Step5:- Create a container from that image

Step5:- Install Jenkins on the Jenkins server

Step6:- Set some steps in Jenkins to automate the process

Go to the Jenkins and set the private IP address of Docker server as Hostname and username

Now create a New job

Now try to create a Dockerfile

Now we have created two containers with the help of DevOps-project image and tomcat:8.0 image

To create the container use the below command

Now we have to open both the ports in Docker-Server instance security group.

Now go to the manage Jenkins --> Credentials --> Add Credential

Likewise, create credentials for the dockeradmin user.

Now create one job

Now try to create one Downstream job

Now build the Deploy-on-docker-container job

Now try to run your application on port no 8080 and give webapp as an extension.

Successfully deployed application on docker container.

Let's try to modify the index file and see what happens next