TASK-2 Integration of Docker Jenkins Git Docker

TASK-2 Integration of Docker Jenkins Git Docker

TASK-2 MLOPS AND DEVOPSAL

Task:-

1. Create container image that has Jenkins installed using dockerfile 

2. When we launch this image, it should automatically start Jenkins service in the container.

3. Create a job chain of job1, job2, job3 and job4 using build pipeline plugin in Jenkins 

4. Job1: Pull the Github repo automatically when some developers push repo to Github.

5. Job2: By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).

6. Job3: Test your app if it is working or not.

7. Job4: if app is not working, then send an email to the developer with error messages.

8. Create One extra job job5 for monitor: If the container where app is running. fails due to any reason then this job should automatically start the container again.

Lets go step by step

1. Creating Jenkins image by Dockerfile

No alt text provided for this image

In this Dockerfile we can use the centos:7 as a base OS and on that centos image we can install get sudo tools net-tools.and then we can add Docker repo for installing the docker onto the image after adding docker repo we can download docker after docker install I add Jenkins repo to the repo files then after this we can import Jenkins rpm and then we can install Jenkins in the docker so as we know Jenkins require java so we have to install java also .and we can install git python so after install all this steps we can start the service of docker and Jenkins and after this we can give sudo power to the Jenkins user to run the command.

Now the Dockerfile is ready , we can build our image by the following command

docker build -t <image-name:version> .

docker build -t jenkins:latest .               #example
No alt text provided for this image

After the success of build, launch the image by the following command

docker run -it --name <container_name> -p 8088:8080 <image:version>


docker run -it -p 8088:8080 --name jenkins-v /root/jenkins-docker/:/root/.jenkins/
-v /var/run/docker.sock:/var/run/docker.sock-v /root/Task2:/root/Task2
  
jenkins:latest 

Jenkins is running on the port 8088, you can confirm by searching https://<hostip>:8088 for exmaple https://192.168.1.104:8088

No alt text provided for this image
No alt text provided for this image

getting start

After launching the container copy this Admin password

Paste it in 192.168.99.101:8088 for Jenkins login

No alt text provided for this image

JENKINS FIRST PAGE

No alt text provided for this image

JOB #1

Pull the Github repo automatically when some developers push repo to Github.we have to trigger it remotely by the use of tokens or we can also use githubs webhooks

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

JOB#2

 Job2 ( container launching acc. to the file)

In this we first check the file extension according to which we will launch the container, it means if the file extension is in php then it will launch the container which has php compiler and interpreter and if the file extension is HTML then it launch container with httpd image.

No alt text provided for this image
No alt text provided for this image

OUTPUT OF JOB2

No alt text provided for this image

Job3 ( testing the env )

In This job we will test if the code is running successfully, that can be detected by the status code if status is other than 200 it means code fails and the job3 also fails , and our further pipeline stops. and if status code is 200 then it means our webserver in docker is running successfully

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

SUCCESFULL OP OF JOB3

No alt text provided for this image

JOB#4 (launch the container again if it goes down )

In This job extra job not included in the pipeline, it will check the container in every minute , if the containers fail due to any reasons it will launch the container again

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


VIEW OF ALL JOBS

No alt text provided for this image

CREATING PIPELINE

No alt text provided for this image

FINAL OUTPUT

In this section we will confirm that our docker is running and it also launch httpd webserver on it also start it service so by which we can see the output

No alt text provided for this image


GITHUB URL
















要查看或添加评论,请登录

Gaurav Rathi的更多文章

  • GUI Application inside Docker

    GUI Application inside Docker

    Docker containers run as a process under the main operating system, you can run multiple containers on a single…

  • Industry Use-Cases of Jenkins

    Industry Use-Cases of Jenkins

    In this article, we are going to learn about the DevOps tool and the name of that tool is Jenkins This is the main tool…

  • Research for Industry Use-Cases of Openshift

    Research for Industry Use-Cases of Openshift

    In this article we are going to learn about OpenShift and how it works and what is the need for these tools in the…

  • NETFLIX-AWS CASE STUDY

    NETFLIX-AWS CASE STUDY

    In this blog, we are going to learn how Netflix uses AWS cloud to run its business. AWS provides resources to Netflix…

  • Industry Use-Case of Neural Networks(NN)

    Industry Use-Case of Neural Networks(NN)

    What is a Neural Network? Neural networks can be taught to perform complex tasks and do not require programming as…

  • AKS-Azure Kubernetes Service

    AKS-Azure Kubernetes Service

    AKS is a good example of INFRASTRUCTURE as a Service and PLATFORM as a Service. Here as we know Azure is a public…

  • Summary of Expert Session Delivered on Kubernetes | Container | Openshift

    Summary of Expert Session Delivered on Kubernetes | Container | Openshift

    Hello Connections, “Expert session on Industry use cases of Kubernetes/OpenShift ” was one of the great sessions. Which…

  • Git and GitHub Workshop

    Git and GitHub Workshop

    What is GIT? Git is a distributed version control system for tracking changes in any set of files, originally designed…

  • ARTH - Task 14.2 ??????

    ARTH - Task 14.2 ??????

    *Task Description*?? ?? *14.2* Further in ARTH - Task 10 has to create an Ansible playbook that will retrieve new…

  • ARTH - Task 14.3 ??????

    ARTH - Task 14.3 ??????

    Task Description: Create an Ansible Playbook which Dynamically Loads Variable Filename same as OS_Name and just by…

社区洞察

其他会员也浏览了