If you are learning DevOps, one topic you will hear again and again is CI/CD. Companies want faster software delivery, fewer errors, and smooth deployments. That is why many teams use CI/CD pipeline using Jenkins and Git.
In this blog, you will learn how to create CI/CD pipeline Jenkins in a simple step-by-step way. We will also cover a Jenkins CI/CD pipeline example, explain Jenkins CI/CD pipeline stages, and share a full guide on CI/CD pipeline Jenkins Docker step by step.
What is CI/CD in DevOps?
CI/CD is a process that helps developers build, test, and deploy code automatically.
CI means Continuous Integration
Continuous Integration means developers push code to Git regularly, and Jenkins automatically builds and tests it.
CD means Continuous Delivery or Continuous Deployment
Continuous Delivery means code is ready for deployment anytime.
Continuous Deployment means code is deployed automatically without manual work.
In simple words, CI/CD helps you move code from your laptop to the live server faster and safely.
Why Use Jenkins and Git for CI/CD?
Jenkins and Git are one of the most common combinations in DevOps.
Why Git?
Git is used for version control. It stores code changes and keeps a history of who changed what.
Why Jenkins?
Jenkins is an automation tool. It takes code from Git and runs tasks like build, test, and deploy.
That is why many people search for:
- ci/cd pipeline using jenkins and github
- how to create ci/cd pipeline jenkins
- jenkins ci/cd pipeline example
- jenkins ci/cd pipeline stages
What You Need Before Creating a Jenkins CI/CD Pipeline
Before you start, make sure you have these things:
- A GitHub account
- A Git repository with your project code
- Jenkins installed on a server or local machine
- Java installed (Jenkins needs Java)
- Git installed on Jenkins machine
- Docker installed (optional but useful)
If you want to build a CI/CD pipeline for Docker deployment, then Docker is required.
Jenkins CI/CD Pipeline Stages
Before we start the steps, you should understand the Jenkins CI/CD pipeline stages.
A standard pipeline usually has these stages:
- Checkout (Pull Code from Git)
- Build
- Unit Test
- Code Quality Check
- Security Scan (Optional)
- Create Artifact / Docker Image
- Deploy to Server
- Post Actions (Email, Slack alerts)
Not every company uses all stages, but this is the normal pipeline flow.
Step 1: Create a GitHub Repository
To build a CI/CD pipeline using Jenkins and GitHub, first you need a GitHub repository.
What to do:
- Create a repo in GitHub
- Push your project code
- Add a simple file like README.md
- Make sure your code builds correctly on your system
Example projects you can use:
- Java Maven project
- Node.js project
- Python app
- Simple HTML website
Step 2: Install Jenkins
You can install Jenkins on:
- Windows
- Linux (Ubuntu is most common)
- Docker container
- AWS EC2
Most DevOps learners use Ubuntu server.
After installation:
- Open Jenkins in browser
- Login using admin password
- Install suggested plugins
Step 3: Install Required Jenkins Plugins
For CI/CD pipeline using Jenkins and GitHub, you need some plugins.
Important plugins:
- Git plugin
- Pipeline plugin
- GitHub Integration plugin
- Docker plugin (if using Docker)
- Blue Ocean plugin (optional, for better UI)
You can install plugins from:
Manage Jenkins → Plugins
Step 4: Connect Jenkins with GitHub
Now you need to connect Jenkins with your GitHub repo.
Option 1: Public Repo
If your repo is public, Jenkins can pull code without login.
Option 2: Private Repo
For private repo, you need:
- GitHub personal access token
or
- SSH key setup
This step is very important when building ci/cd pipeline using jenkins and github.
Step 5: Create a Jenkins Job
In Jenkins dashboard:
- Click New Item
- Enter job name (example: My-CICD-Pipeline)
- Select Pipeline
- Click OK
Now you will see pipeline configuration.
Step 6: Add Pipeline Script
The best way to create a pipeline is by using a Jenkinsfile.
A Jenkinsfile is a file inside your Git repo that contains pipeline steps.
Why Jenkinsfile is important?
- Pipeline is stored in Git
- Easy to manage
- Works for teams
- Used in real companies
Jenkins CI/CD Pipeline Example
Below is a simple jenkins ci/cd pipeline example:
Pipeline stages:
- Checkout code
- Build
- Test
Example structure (not code, just flow):
- Stage 1: Pull code from GitHub
- Stage 2: Build project
- Stage 3: Run tests
- Stage 4: Deploy (optional)
This is the most basic pipeline for beginners.
Step 7: How to Create CI/CD Pipeline Jenkins
Now let’s understand the full steps clearly.
Step 7.1: Add Jenkinsfile in GitHub Repo
Create a file named:
Jenkinsfile
Inside it, define stages like:
- Checkout
- Build
- Test
- Deploy
Commit and push the Jenkinsfile to GitHub.
Step 7.2: Configure Jenkins Pipeline
In Jenkins pipeline job settings:
- Go to Pipeline section
- Select “Pipeline script from SCM”
- Select SCM: Git
- Add repo URL
- Add branch name (example: main)
- Save
Now Jenkins will read the Jenkinsfile from GitHub.
Step 8: Run the Pipeline in Jenkins
Now click:
Build Now
Jenkins will:
- Pull code
- Run pipeline stages
- Show output logs
If any stage fails, Jenkins will stop and show error.
This is how CI/CD automation works.
CI/CD Pipeline Jenkins Docker Step by Step
Now let’s cover the most searched topic:
ci/cd pipeline jenkins docker step by step
Many companies use Docker because it makes deployment easy and fast.
What is Docker in CI/CD?
Docker creates an image of your application. That image can run anywhere.
Why use Docker with Jenkins?
- Same environment everywhere
- Easy deployment
- Faster release
- Works well with Kubernetes later
Step-by-Step Docker Pipeline Flow
Here is the normal flow:
- Jenkins pulls code from GitHub
- Jenkins builds the app
- Jenkins creates Docker image
- Jenkins pushes image to Docker Hub (optional)
- Jenkins runs container on server
Example Jenkins CI/CD Pipeline Stages for Docker
A Docker pipeline usually has these stages:
- Checkout
- Build
- Test
- Build Docker Image
- Push Docker Image
- Deploy Container
This is a very common setup in real DevOps projects.
How to Add GitHub Webhook for Auto Build
If you want Jenkins to run automatically whenever code is pushed, you need GitHub Webhook.
Steps:
1.Go to GitHub repo settings
2.Click Webhooks
3.Add webhook URL:
http://your-jenkins-url/github-webhook/
4. Select events: push
5.Save
Now every time you push code, Jenkins pipeline will run automatically.
This is a key part of ci/cd pipeline using jenkins and github.
Best Practices for Jenkins and Git CI/CD Pipeline
To make your pipeline strong and professional, follow these tips:
Use Proper Branching Strategy
Example:
- main branch for production
- dev branch for development
- feature branches for new work
Keep Jenkinsfile Clean
Do not write too many commands in one stage.
Add Testing
Testing is important to avoid broken code deployment.
Use Environment Variables
Store secrets safely like:
- Docker password
- GitHub token
- Server credentials
Use Build Notifications
Add email or Slack alerts so team knows pipeline status.
Common Errors in Jenkins CI/CD Pipeline
Here are some common problems beginners face:
Git Authentication Error
Happens when repo is private and credentials are missing.
Build Failed
Happens when project dependencies are missing.
Docker Permission Denied
Happens when Jenkins user does not have Docker access.
Webhook Not Working
Happens when Jenkins URL is not public or correct.
Why Jenkins is Still Popular for CI/CD?
Even today, Jenkins is one of the most used CI/CD tools.
Reasons:
- Free and open source
- Works with almost every tool
- Large community support
- Can be used for small and large projects
- Strong plugin system
That is why people still search for:
how to create ci/cd pipeline jenkins
Real-Life Use Case of Jenkins and GitHub Pipeline
Let’s take a simple example.
A company has a website project in GitHub.
Every time a developer pushes code:
- Jenkins pulls code
- Jenkins runs tests
- Jenkins creates Docker image
- Jenkins deploys to server
This saves time and avoids manual mistakes.
FAQs
1. What is CI/CD pipeline using Jenkins and GitHub?
It is an automated process where Jenkins pulls code from GitHub, runs build and tests, and deploys the application automatically.
2. What are Jenkins CI/CD pipeline stages?
The main Jenkins CI/CD pipeline stages are checkout, build, test, deploy, and post actions like notifications.
3. How to create CI/CD pipeline Jenkins for beginners?
You can create a pipeline by installing Jenkins, connecting GitHub repo, creating a pipeline job, and adding a Jenkinsfile in your repo.
4. What is a Jenkins CI/CD pipeline example?
A simple example is: Jenkins pulls code → builds project → runs tests → deploys to server.
5. How does CI/CD pipeline Jenkins Docker step by step work?
Jenkins pulls code, builds the app, creates a Docker image, and runs the container on a server or pushes it to Docker Hub.
6. Can Jenkins run automatically when code is pushed?
Yes. You can connect GitHub webhook with Jenkins so the pipeline runs automatically on every push.
7. Do I need Docker for Jenkins CI/CD pipeline?
No. Docker is optional. But Docker is very useful for modern deployments and is widely used in DevOps.
8. Is Jenkins better than GitHub Actions?
Jenkins is more flexible and works with many tools. GitHub Actions is easier for GitHub projects. Both are good, but Jenkins is still widely used in companies.
Final Words
Building a CI/CD pipeline using Jenkins and Git is one of the best DevOps skills you can learn. It helps you automate your work, reduce errors, and deploy faster.
In this guide, you learned:
- how to create ci/cd pipeline jenkins
- jenkins ci/cd pipeline example
- jenkins ci/cd pipeline stages
- ci/cd pipeline jenkins docker step by step
- how to connect Jenkins with GitHub webhook

