top of page

Jenkins how to use

Task: Jenkins Installation Using Docker


Step 1: Pull Jenkins LTS

docker pull jenkins/jenkins:lts

Step 2: Create a Docker Volume

docker volume create jenkins_home

Step 3: Run Jenkins


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


Step 4: Get the Initial Password

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


OR

docker exec -it jenkins bash 
jenkins@ed2de315cb2d:/$
cat /var/jenkins_home/secrets/initialAdminPassword

Step 5

Open

  • Paste password

  • Install Suggested Plugins


    Create Admin User



Lab 2: First Pipeline

From Jenkins Dashboard

New Item

Name

FirstPipeline

Select

Pipeline

Click OK

Scroll to

Pipeline

Choose

Pipeline Script

Paste

pipeline {


agent any


stages {


stage('Hello') {

steps {

echo 'Hello Jenkins'

}

}


stage('System Info') {

steps {

sh 'hostname'

sh 'whoami'

sh 'pwd'

sh 'ls -la'

}

}


stage('Finish') {

steps {

echo 'Pipeline Completed Successfully'

}

}

}

}


Click

Save

Then

Build Now

Output

Hello Jenkins

hostname

whoami

Docker version xx.xx.xx

Pipeline Completed

Step 3 : Build Your First Project

Create a folder

DevOpsLab

Inside it create

index.html
<html>

<head>
<title>DevOps Lab</title>
</head>

<body>

<h1>Hello Jenkins Pipeline</h1>

</body>

</html>

Create

Jenkinsfile
pipeline {

    agent any

    stages {

        stage('Checkout') {
            steps {
                echo 'Checking files'
            }
        }

        stage('List Files') {
            steps {
                bat 'dir'
            }
        }

        stage('Read HTML') {
            steps {
                bat 'type index.html'
            }
        }

    }

}

Lab 4: Connect Jenkins with Git

Install Git on your system.

Go to

Manage Jenkins

Tools

Git

Provide Git installation.

Create a GitHub repository

DevOpsLab

Push

index.html
Jenkinsfile

Now create a new Pipeline

Instead of Pipeline Script choose

Pipeline script from SCM

SCM

Git

Repository

Script Path

Jenkinsfile

Save

Build

Now Jenkins automatically downloads your repository and executes the Jenkinsfile.

Lab 5: Understanding the Pipeline

Checkout
        ↓
Read Jenkinsfile
        ↓
Execute Stage 1
        ↓
Execute Stage 2
        ↓
Execute Stage 3
        ↓
SUCCESS

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

Recommended Products For This Post
 
 
 

Recent Posts

See All

Comments


© 2026 by neoaitech.com

  • Facebook
  • Twitter
  • Instagram
bottom of page