September 21, 2026

How to Setup Jenkins – Step by Step Tutorial

Learn how to install Jenkins with Docker, create your first Pipeline, write a Jenkinsfile, and trigger automated builds from GitHub webhooks.

Updated August 2026 — full tutorial restored for this URL.

TL;DR

  • Jenkins automates software builds and CI/CD workflows through configurable jobs and Pipelines.

  • Install Jenkins quickly with Docker, then unlock it and install the recommended plugins.

  • Create a Pipeline job and connect it to your Git repository using Pipeline script from SCM.

  • A Jenkinsfile defines automated stages such as checkout, build, and testing as code.

  • GitHub webhooks can trigger Jenkins builds automatically whenever you push changes to your repository.

This tutorial walks through installing Jenkins, creating a first Pipeline, and triggering builds from GitHub.

  1. Install Jenkins (Docker quick start)
  2. Unlock and install plugins
  3. Create a Pipeline job
  4. Sample Jenkinsfile
  5. GitHub webhook

1. Install Jenkins (Docker quick start)

docker run -d --name jenkins -p 8080:8080 -p 50000:50000 \
  -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

Open http://localhost:8080. Get the initial admin password:

docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword

2. Unlock and install plugins

Paste the password → Install suggested plugins → create the first admin user.

3. Create a Pipeline job

New Item → Pipeline → OK. Under Pipeline, choose “Pipeline script from SCM” and point at your Git repo (or paste a script for a quick test).

4. Sample Jenkinsfile

pipeline {
  agent any
  stages {
    stage('Checkout') {
      steps { checkout scm }
    }
    stage('Build') {
      steps { sh 'echo Building… && ./mvnw -DskipTests package || npm ci' }
    }
    stage('Test') {
      steps { sh 'echo Tests…' }
    }
  }
}

5. GitHub webhook

In the GitHub repo: Settings → Webhooks → Add webhook. Payload URL: http://YOUR_JENKINS/github-webhook/. Content type JSON. Trigger on push. Install the GitHub plugin in Jenkins if prompted, then push a commit and watch the build.

Related DevOps overview: Introduction to DevOps Tools and Techniques (Wave 3 rebuild).

Final Thought

Jenkins provides a flexible foundation for automating software builds and continuous integration. With Docker, you can get a Jenkins instance running quickly, while Pipeline-as-code makes your build process easier to version, review, and maintain alongside your application.

The basic workflow is simple: Jenkins runs the Pipeline, the Jenkinsfile defines the stages, and GitHub webhooks trigger builds when code changes. Once this foundation is working, you can extend the Pipeline with real compilation, automated tests, deployments, notifications, and other CI/CD steps.

Starting with a small Pipeline is often the best approach. Get the build-and-trigger cycle working first, then gradually add the automation your project actually needs.

Kindson Munonye

Kindson Munonye is a software engineer and technical author covering machine learning, statistics, REST APIs, Python, and software engineering. He publishes free tutorials on The Genius Blog and live classes on Alkademy. GitHub · LinkedIn · About · Alkademy

View all posts by Kindson Munonye →
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted