Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4

TechWorld with Nana · Beginner ·☁️ DevOps & Cloud ·6y ago

Key Takeaways

This video demonstrates how to set up Jenkins from scratch in a Docker container, covering topics such as pulling the Jenkins image, running the container, initializing Jenkins, and installing default plugins. The video also introduces the basics of Jenkins pipelines and project types, including freestyle and pipeline projects.

Full Transcript

so in this video we're gonna set up Jenkins from scratch in a docker container then we're gonna create a multi branch pipeline and connected with a git repository during this step I will also explain how to create different types of credentials in Jenkins and finally I will show you the basics of a Jenkins file to configure this multi branch pipeline so step one is to run Jenkins in a docker container so to use that we need to find an official image for Jenkins on docker hub so let's go and as you see here Jenkins results in an official image and some other images and if you click here you see that this image the official image has been deprecated and the last version is 2.6 T which is very old Jenkins version and instead of it we're gonna use this image here so that would be actually this one because this one is now officially maintained by the Jenkins community and also if you see the text the latest image actually has Jenkins version of to point 219 which for most of the plugins it's important to have a higher Jenkins version otherwise they can't be installed so we're going to take this image and this name of the image so on my command line I'm gonna execute docker run using this image right so I'm gonna dock run and the image however before I run this I need to add some options like I need to expose the port so that I can access it from my browser etc so let's actually go back and see the documentation of how to run this so all the explanation is here so these are some of the options that we're gonna use and actually let's go and do it so first one is I'm gonna expose the ports and the first part I'm gonna expose is port 8080 the Jenkins application inside container will run it port 8080 because Jenkins runs on Tomcat which by default starts at this port and I'm gonna bind it to my hosts port 8080 another port we can expose is 50,000 which is basically a port where drink is master and slave communicate so this will enable my Jenkins to find slaves in case I had some so the ports are open now another thing I'm gonna do is I'm gonna run it in detach mode and I'm also gonna bind volumes to it so to do that I'm gonna use minus B and I'm gonna use a named volume which I'm gonna call Jenkins home meaning I don't have to have this as a folder it's gonna be automatically created I'm just giving it a name which can be whatever you want and I'm gonna bind it to directory inside Jenkins container drink its image under slash bar slash Junkins hope this director is real and it's inside of docker container and this will create automatically create a volume now you have to be careful here because if you were to use a host volume here which basically means that you take an already existing directory on your laptop machine and binding it to the Jenkins container you might get some permission issues meaning the Jenkins user might not be able to write to that folder and that could be a problem you can actually check out my video which I made about docker volumes where you can learn in more detail how this works and the reason why we need to create a volume for Jenkins is to have data persistency for Jenkins so when we remove the container and restarted recreated the data will still be there and the reason why we need to persist this data is because all the Jenkins builds all the configuration and all the Jenkins plugins and also Jenkins users will be stored there so without this data you will basically have to reinitialize the whole Jenkins so important part here and we're gonna use the latest take of Jenkins and these are all the options we need so I'm gonna correct this one here look at here and I'm gonna run this and it's pulling the image from the docker hub it's gonna start in just couple of seconds so the image has been pulled and the docker container must be running already so if I do docker PS I see my Jenkins container running and we actually need its locks so I'm gonna do docker locks with the container ID and I'm gonna see that Jenkins started and its initial setup is needed and this is the password I'm gonna need to initialize it so I'm gonna copy that and if I go to localhost 8080 I will paste that password and it should start initializing so I'm going to go with the suggested plugins and this is gonna take some time to install all the plugins so depends on what technologies your application uses or what source management tools etc he will need different plugins for Jenkins and I'm just gonna go with the community one suggested ones and later of course in Jenkins you can manage these plugins you can delete them you can add new ones etc this is just the base so now that it's done I'm gonna create the first admin user let's go at Jenkins user some password really interesting I'm gonna just mine and I'm gonna leave it localhost Jenkins is ready and this is view I get so if I go to new item because I installed all these plugins I see different types of Jenkins projects I can create but default usually have the freestyle project freestyle project is used for simple single tasks like if you want to just run tests for example whereas with pipeline you can configure the whole delivery flow like test build package deploy your application etc pipeline is a more recent addition so before that they would just chain multiple freestyle projects to get a pipeline like project the pipeline project type is just for a single branch but in this video we're going to create a multi branch pipeline which will apply to multiple branches of the same repository and if I go to manage Jenkins that's where you as an admin user have all the tools to configure Jenkins and under manage plugins you can actually add or delete or manage or update the plugins that you have so in available I have all the plugins that I could install in addition to my Jenkins and install I have all the ones that I have actually selected at the beginning you can remove them again or you can add new plugins in the next section of this video I'm gonna show you how to create a multi branch pipeline and how to connect it to your kid repository and how to build your project using that pipeline

Original Description

Learn how to run Jenkins in a Docker Container. This video covers the following: * Pull Jenkins Image and run container * Initialize Jenkins and install default plugins * Create First Admin User * Types of Jenkins Projects For any questions/issues/feedback, please leave me a comment and I will get back to you as soon as possible. #devops #jenkins #docker #techworldwithnana ------------------------------------------------------------------------------------------------------- Complete Docker and Kubernetes tutorial ► https://bit.ly/2YGeRp9 What is Kubernetes? ► https://youtu.be/VnvRFRk_51k Docker 🐳 vs Kubernetes ► https://youtu.be/9_s3h_GVzZc Complete Jenkins Pipeline Tutorial ► https://youtu.be/7KCS70sCoK0 ----------------------------------------------------------------------------------- ✅ Connect with me ► Youtube: https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA ► DEV: https://dev.to/techworld_with_nana ► Instagram: https://www.instagram.com/techworld_with_nana/ ► Twitter: https://twitter.com/Njuchi_/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from TechWorld with Nana · TechWorld with Nana · 24 of 60

1 What is Docker? Docker container concept explained || Docker Tutorial 1
What is Docker? Docker container concept explained || Docker Tutorial 1
TechWorld with Nana
2 What is a Docker Container? Docker Demo || Docker Tutorial 2
What is a Docker Container? Docker Demo || Docker Tutorial 2
TechWorld with Nana
3 How to install docker? Step by Step || Docker Tutorial 3
How to install docker? Step by Step || Docker Tutorial 3
TechWorld with Nana
4 8 Basic Docker Commands || Docker Tutorial 4
8 Basic Docker Commands || Docker Tutorial 4
TechWorld with Nana
5 Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
Debugging Docker Containers with docker exec and docker logs || Docker Tutorial 5
TechWorld with Nana
6 Docker vs Virtual Machine | simply explained || Docker Tutorial 6
Docker vs Virtual Machine | simply explained || Docker Tutorial 6
TechWorld with Nana
7 Overview of Workflow with Docker - Docker in Practice || Docker Tutorial 7
Overview of Workflow with Docker - Docker in Practice || Docker Tutorial 7
TechWorld with Nana
8 Developing with Docker - Docker in Practice || Docker Tutorial 8
Developing with Docker - Docker in Practice || Docker Tutorial 8
TechWorld with Nana
9 Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
Docker Compose Tutorial - Docker in Practice || Docker Tutorial 9
TechWorld with Nana
10 Dockerfile Tutorial - Docker in Practice || Docker Tutorial 10
Dockerfile Tutorial - Docker in Practice || Docker Tutorial 10
TechWorld with Nana
11 Private Repository explained | Registry on AWS - Docker in Practice || Docker Tutorial 11
Private Repository explained | Registry on AWS - Docker in Practice || Docker Tutorial 11
TechWorld with Nana
12 Docker Volumes explained in 6 minutes
Docker Volumes explained in 6 minutes
TechWorld with Nana
13 Deploying the containerized application with Docker Compose || Docker Tutorial 12
Deploying the containerized application with Docker Compose || Docker Tutorial 12
TechWorld with Nana
14 Docker Volumes Demo || Docker Tutorial 13
Docker Volumes Demo || Docker Tutorial 13
TechWorld with Nana
15 Docker vs Kubernetes vs Docker Swarm | Comparison in 5 mins
Docker vs Kubernetes vs Docker Swarm | Comparison in 5 mins
TechWorld with Nana
16 What is Kubernetes | Kubernetes explained in 15 mins
What is Kubernetes | Kubernetes explained in 15 mins
TechWorld with Nana
17 Kubernetes Components explained! Pods, Services, Secrets, ConfigMap | Kubernetes Tutorial 14
Kubernetes Components explained! Pods, Services, Secrets, ConfigMap | Kubernetes Tutorial 14
TechWorld with Nana
18 Kubernetes Architecture explained | Kubernetes Tutorial 15
Kubernetes Architecture explained | Kubernetes Tutorial 15
TechWorld with Nana
19 Benefits of Kubernetes | Scalability, High Availability, Disaster Recovery | Kubernetes Tutorial 16
Benefits of Kubernetes | Scalability, High Availability, Disaster Recovery | Kubernetes Tutorial 16
TechWorld with Nana
20 Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
Minikube and Kubectl explained | Setup for Beginners | Kubernetes Tutorial 17
TechWorld with Nana
21 Top 3 programming languages to learn in 2020 | meta analysis
Top 3 programming languages to learn in 2020 | meta analysis
TechWorld with Nana
22 Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18
Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18
TechWorld with Nana
23 Kubernetes YAML File Explained - Deployment and Service | Kubernetes Tutorial 19
Kubernetes YAML File Explained - Deployment and Service | Kubernetes Tutorial 19
TechWorld with Nana
Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4
Run Jenkins in Docker Container - Jenkins Pipeline Tutorial for Beginners 1/4
TechWorld with Nana
25 Create Multibranch Pipeline with Git - Jenkins Pipeline Tutorial for Beginners 2/4
Create Multibranch Pipeline with Git - Jenkins Pipeline Tutorial for Beginners 2/4
TechWorld with Nana
26 Jenkinsfile - Jenkins Pipeline Tutorial for Beginners 3/4
Jenkinsfile - Jenkins Pipeline Tutorial for Beginners 3/4
TechWorld with Nana
27 Trigger Jenkins Build automatically - Jenkins Pipeline Tutorial for Beginners 4/4
Trigger Jenkins Build automatically - Jenkins Pipeline Tutorial for Beginners 4/4
TechWorld with Nana
28 Complete Application Deployment using Kubernetes Components | Kubernetes Tutorial 20
Complete Application Deployment using Kubernetes Components | Kubernetes Tutorial 20
TechWorld with Nana
29 Kubernetes Namespaces Explained in 15 mins | Kubernetes Tutorial 21
Kubernetes Namespaces Explained in 15 mins | Kubernetes Tutorial 21
TechWorld with Nana
30 Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
Configure Build Tools in Jenkins and Jenkinsfile | Jenkins Tutorial
TechWorld with Nana
31 Complete Jenkins Pipeline Tutorial | Jenkinsfile explained
Complete Jenkins Pipeline Tutorial | Jenkinsfile explained
TechWorld with Nana
32 Kubernetes Ingress Tutorial for Beginners | simply explained  | Kubernetes Tutorial 22
Kubernetes Ingress Tutorial for Beginners | simply explained | Kubernetes Tutorial 22
TechWorld with Nana
33 What is Helm in Kubernetes? Helm and Helm Charts explained  | Kubernetes Tutorial 23
What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23
TechWorld with Nana
34 How Websites Work | simply explained with examples
How Websites Work | simply explained with examples
TechWorld with Nana
35 What is JavaScript? | JavaScript Tutorial #1
What is JavaScript? | JavaScript Tutorial #1
TechWorld with Nana
36 What is Ansible | Ansible Playbook explained | Ansible Tutorial for Beginners
What is Ansible | Ansible Playbook explained | Ansible Tutorial for Beginners
TechWorld with Nana
37 JavaScript Variables & JavaScript Data Types explained | JavaScript Tutorial #2
JavaScript Variables & JavaScript Data Types explained | JavaScript Tutorial #2
TechWorld with Nana
38 How Prometheus Monitoring works | Prometheus Architecture explained
How Prometheus Monitoring works | Prometheus Architecture explained
TechWorld with Nana
39 Where to write JavaScript | Where to execute JavaScript Code | JavaScript Tutorial #3
Where to write JavaScript | Where to execute JavaScript Code | JavaScript Tutorial #3
TechWorld with Nana
40 JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
JavaScript Operators & JavaScript Conditionals | JavaScript Tutorial #4
TechWorld with Nana
41 Pods and Containers - Kubernetes Networking | Container Communication inside the Pod
Pods and Containers - Kubernetes Networking | Container Communication inside the Pod
TechWorld with Nana
42 Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class
TechWorld with Nana
43 Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo
Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo
TechWorld with Nana
44 Pull Image from Private Docker Registry in Kubernetes cluster | Demo
Pull Image from Private Docker Registry in Kubernetes cluster | Demo
TechWorld with Nana
45 Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet
TechWorld with Nana
46 Yaml Tutorial | Learn YAML in 18 mins
Yaml Tutorial | Learn YAML in 18 mins
TechWorld with Nana
47 Terraform explained in 15 mins | Terraform Tutorial for Beginners
Terraform explained in 15 mins | Terraform Tutorial for Beginners
TechWorld with Nana
48 Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator | Part 1
Setup Prometheus Monitoring on Kubernetes using Helm and Prometheus Operator | Part 1
TechWorld with Nana
49 Managed Kubernetes Cluster explained | Kubernetes on Cloud (1/2)
Managed Kubernetes Cluster explained | Kubernetes on Cloud (1/2)
TechWorld with Nana
50 Step by Step Application Deployment on LKE using Helm | Kubernetes on Cloud (2/2)
Step by Step Application Deployment on LKE using Helm | Kubernetes on Cloud (2/2)
TechWorld with Nana
51 Kubernetes Operator simply explained in 10 mins
Kubernetes Operator simply explained in 10 mins
TechWorld with Nana
52 What is Infrastructure as Code? Difference of Infrastructure as Code Tools
What is Infrastructure as Code? Difference of Infrastructure as Code Tools
TechWorld with Nana
53 AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
AWS EKS - Create Kubernetes cluster on Amazon EKS | the easy way
TechWorld with Nana
54 Prometheus Monitoring - Steps to monitor third-party apps using Prometheus Exporter | Part 2
Prometheus Monitoring - Steps to monitor third-party apps using Prometheus Exporter | Part 2
TechWorld with Nana
55 GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
TechWorld with Nana
56 Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
Docker Tutorial for Beginners [FULL COURSE in 3 Hours]
TechWorld with Nana
57 Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service
Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service
TechWorld with Nana
58 Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
Kubernetes Tutorial for Beginners [FULL COURSE in 4 Hours]
TechWorld with Nana
59 Containers on AWS Overview: ECS | EKS | Fargate | ECR
Containers on AWS Overview: ECS | EKS | Fargate | ECR
TechWorld with Nana
60 Kubernetes is dropping Docker support - What does it mean for YOU?
Kubernetes is dropping Docker support - What does it mean for YOU?
TechWorld with Nana

This video teaches how to set up Jenkins in a Docker container and create a multi-branch pipeline. It covers the basics of Jenkins and Docker, and demonstrates how to initialize Jenkins and install default plugins. The video is aimed at beginners and provides a comprehensive introduction to Jenkins and CI/CD pipelines.

Key Takeaways
  1. Pull the Jenkins image from Docker Hub
  2. Run the Jenkins container using Docker
  3. Initialize Jenkins and install default plugins
  4. Create a first admin user
  5. Explore Jenkins project types, including freestyle and pipeline projects
💡 Using a Docker container to run Jenkins provides a flexible and scalable way to manage CI/CD pipelines, and allows for easy integration with other tools and services.

Related AI Lessons

Up next
How to Open KRP Files (Krita Document)
File Extension Geeks
Watch →