Quick Answer: This Jenkins tutorial takes you from the basics to advanced CI/CD, updated for 2026 — installing Jenkins, creating jobs, writing declarative pipelines with a Jenkinsfile, using agents and plugins, and integrating Docker and Kubernetes.

What is Jenkins?
Jenkins is an open-source automation server that powers continuous integration and continuous delivery (CI/CD). It automatically builds, tests, and deploys your code whenever changes are pushed, and is extensible through 1,800+ plugins. Written in Java, it runs on any major OS.
Installing Jenkins
The fastest way to try Jenkins in 2026 is via Docker:
# Run Jenkins LTS in Docker
docker run -d --name jenkins \
-p 8080:8080 -p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
# Get the initial admin password
docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPasswordOpen http://localhost:8080, enter the password, install suggested plugins, and create your admin user. On a server, you can also install the native package on Ubuntu (requires Java 17+).
Jenkins Architecture
- Controller — schedules builds, stores config, and serves the UI.
- Agents (nodes) — execute the build jobs, enabling distributed builds.
- Executors — slots on a node that run jobs in parallel.
Creating Your First Job
- Click New Item → choose Freestyle project (simple) or Pipeline (code-based).
- Configure the Git repository URL and credentials.
- Add a build step (e.g., a shell command or build tool).
- Set a trigger (poll SCM, webhook, or cron).
- Save and click Build Now, then view the console output.
Pipelines as Code (Jenkinsfile)
Modern Jenkins uses pipelines defined as code in a Jenkinsfile committed to your repo. Here’s a declarative example:
pipeline {
agent any
environment {
IMAGE = "myapp:${env.BUILD_NUMBER}"
}
stages {
stage('Build') {
steps { sh 'docker build -t $IMAGE .' }
}
stage('Test') {
steps { sh 'docker run --rm $IMAGE npm test' }
}
stage('Deploy') {
steps { sh './deploy.sh $IMAGE' }
}
}
post {
success { echo 'Pipeline succeeded!' }
failure { echo 'Pipeline failed.' }
}
}Declarative vs Scripted Pipelines
Declarative uses a clean, structured syntax (recommended for most). Scripted uses full Groovy for complex, programmatic logic.
Triggers & Automation
- Webhooks — the repo notifies Jenkins on push (best practice).
- Poll SCM — Jenkins checks the repo on a schedule.
- Cron — time-based triggers.
- Multibranch pipelines — auto-create jobs for each branch with a Jenkinsfile.
Plugins & Credentials
Extend Jenkins with plugins: Git, Docker, Kubernetes, Blue Ocean, SonarQube, and more. Store secrets with the Credentials plugin and reference them by ID — never hardcode passwords or tokens in a Jenkinsfile.
Advanced: Docker & Kubernetes
- Docker agents — run each build in a clean container for reproducibility.
- Kubernetes plugin — spin up ephemeral agents as Pods on demand.
- Shared libraries — reuse pipeline code across many projects.
- Parallel stages — run tests/builds concurrently to speed up pipelines.
Best Practices for 2026
- Keep pipelines as code in version control.
- Use Configuration as Code (JCasC) for reproducible Jenkins setups.
- Secure Jenkins with RBAC, HTTPS, and managed credentials.
- Use ephemeral, containerized agents instead of long-lived nodes.
- Add security and quality scanning stages (DevSecOps).
Conclusion
Jenkins remains a powerful, flexible CI/CD tool in 2026. Start with a simple pipeline, move your configuration into a Jenkinsfile, add Docker/Kubernetes agents, and adopt the best practices above. Then test your knowledge with our 50 Jenkins Interview Questions, and map your path with the DevOps Roadmap.
Frequently Asked Questions
Is Jenkins hard to learn?
No — basic jobs are easy to set up. The learning curve comes with pipelines as code, distributed agents, and integrations, which this tutorial covers step by step.
Jenkins or GitHub Actions in 2026?
Jenkins suits self-hosted, highly customizable enterprise CI/CD; GitHub Actions is simpler and cloud-native. Many teams use both.
What language is a Jenkinsfile written in?
Groovy-based syntax — either declarative (structured) or scripted (full Groovy).

