Jenkins how to use
- Sharon Rajendra Manmothe

- 5 days ago
- 2 min read
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 ItemName
FirstPipelineSelect
PipelineClick OK
Scroll to
PipelineChoose
Pipeline ScriptPaste
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
SaveThen
Build Now
Output
Hello Jenkins
hostname
whoami
Docker version xx.xx.xx
Pipeline Completed
Step 3 : Build Your First Project
Create a folder
DevOpsLabInside it create
index.html<html>
<head>
<title>DevOps Lab</title>
</head>
<body>
<h1>Hello Jenkins Pipeline</h1>
</body>
</html>Create
Jenkinsfilepipeline {
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↓
GitProvide Git installation.
Create a GitHub repository
DevOpsLabPush
index.html
JenkinsfileNow create a new Pipeline
Instead of Pipeline Script choose
Pipeline script from SCMSCM
GitRepository
Script Path
JenkinsfileSave
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.



Comments