Integrating the Git, Jenkins, Docker for automation

In this task, I have integrated the Docker with Jenkins and Git for continuous integration.

Tasks :

  1. Create the docker image which contains the Jenkins and Git.
  2. Run the Jenkins image and pull the git repo from the GitHub as soon and the developer commits the file.
  3. By looking at the file whether HTML, PHP, etc Jenkins will run the respective language interpreter in the docker images.
  4. If for some reason the interpreter stops working or any error occurred the Jenkins will send the email to the developer to notify then.
  5. Once if for any reason the interpreter stops the job 4 will start the interpreter again of the respective language.

Creating the Docker File :

  • For creating the docker file save the file name with Dockerfile.
FROM centos

RUN yum install wget -y
RUN wget -O /etc/yum.repos.d/jenkins.repo
RUN rpm --import
RUN yum install sudo -y
RUN yum install git -y
RUN yum install java-11-openjdk.x86_64 -y
RUN yum install jenkins -y
RUN yum install python3 -y
RUN yum install curl -y
RUN echo -e "jenkins ALL=(ALL) NOPASSWD: ALL" >> etc/sudoers
CMD java -jar /usr/lib/jenkins/jenkins.war

Here’s the various keywords we used in it:

  • FROM: the base image to be used for the container.
  • RUN: execute these commands on the base image obtained.
  • CMD: to start a service when the container starts.
  • COPY: to copy the content inside the image.

Building the Dockerfile :

docker build -t jenkins:latest .
  • On successful build, you will see a screen like this.

Running the Jenkins Image :

docker run -it --privileged -p 9000:8080 -v /:/host jenkin:latest
  • Privileged: It is used for special access to be used later while playing with dockers.
  • -V : to mount the local files inside the containers.
  • Copy the marked password.
  • In administrator password paste the above copied password .

Now we will be moving on to our jobs:



  • This will be triggered as soon as Job1 completes and will deploy a container on the host system.


  • Job3 will be successfully built if the test fails so it can go to Job4 and mail to developer.


  • conatins


  • This is set for monitoring job to check every minute for the status of the container.
  • Thanks, hope you guys will like my article. if you have any suggestion or query will free to ask.

#Happylearning #keepsharing #devops #integration




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fathym vs. Netlify and Vercel: Open Up New Possibilities with Micro Frontends

$earching the College de France — part 4

How to mine Ravencoin?

How to get started in iOS Application Development

How to Deploy Django Application on AWS using ECS and ECR?

My Kubernetes Notes

A Better Flutter App #1

Shabak challenge — Baby RISC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Creating an EC2 Instance with an Apache Web Server Using AWS CLI

Mobile App Development Using Python

Using AWS SAM to build and deploy — Beginner’s guide

Automation Using AWS Lambda Function, S3 and API Gateway to Control EC2 Server and Send Email