Jenkins Server as Docker container.

Jenkins Server as Docker container.

Welcome to the comprehensive guide on installing Jenkins on Docker. Jenkins is a open source automation server that helps in building, deploying, and automating projects.

Docker simplifies the process by providing a consistent environment across multiple systems. Let's deep dive into the process of setting up Jenkins on Docker.

Prerequisites

Before we begin, make sure you should have the following installations.

1. Docker Installed: Ensure docker is installed by typing this code on your shell.

docker --version         
Docker version 25.0.4, build 1a576c5        

2. Basic Command Line Knowledge: Familiarity with command-line operations will be beneficial.

Step 1: Pulling the Docker Dind Image

docker pull docker:dind        

Step 2: Create a Jenkins bridge Network

docker network create -d bridge jenkins        

Step 3: Run the docker dind image

docker run \

--name jenkins-docker \

--rm \

--detach \

--privileged \

--network jenkins \

--network-alias docker \

--env DOCKER_TLS_CERTDIR=/certs \

--volume jenkins-docker-certs:/certs/client \

--volume jenkins-data:/var/jenkins_home \

--publish 2376:2376 \

docker:dind \

--storage-driver overlay2

Step 4: Now you need to Customize the official Jenkins Docker image, by executing the following two steps:

a. Create a Docker file with the following content:

FROM jenkins/jenkins:2.452.2-jdk17

USER root

RUN apt-get update && apt-get install -y lsb-release

RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \

https://download.docker.com/linux/debian/gpg

RUN echo "deb [arch=$(dpkg --print-architecture) \

signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \

https://download.docker.com/linux/debian \

$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list

RUN apt-get update && apt-get install -y docker-ce-cli

USER jenkins

RUN jenkins-plugin-cli --plugins "blueocean docker-workflow"

b. Build a new docker image from this Dockerfile, and assign the image a meaningful name, such as "myjenkins-blueocean:2.452.2-1":

docker build -t myjenkins-blueocean:2.452.2-1 .

Step 5: Run your own myjenkins-blueocean:2.452.2-1 image as a container in Docker using the following docker run command:

docker run \

--name jenkins-blueocean \

--restart=on-failure \

--detach \

--network jenkins \

--env DOCKER_HOST=tcp://docker:2376 \

--env DOCKER_CERT_PATH=/certs/client \

--env DOCKER_TLS_VERIFY=1 \

--publish 8080:8080 \

--publish 50000:50000 \

--volume jenkins-data:/var/jenkins_home \

--volume jenkins-docker-certs:/certs/client:ro \

myjenkins-blueocean:2.452.2-1

Step 5: Accessing you Jenkins controller.

- Open a web browser.

- Navigate to https://localhost:8080.


Nikhil Vats

Human resources managment

5 个月

Hi Prateek ! CreditDhara is a comprehensive loan aggregator platform designed to simplify access to credit and financial services. It connects users with multiple financial institutions, allowing them to compare and select the best loan options. The platform offers automated credit score assessments and personalized loan recommendations to enhance the borrowing experience. CreditDhara's user-friendly interface makes it easy for individuals and businesses to find tailored financial solutions. With partnerships across leading banks and NBFCs, CreditDhara is committed to providing transparency and ease in financial decision-making. Nikhil this side i was going through your profile . if you are looking for the job and for the job. please let me know We have an opening for (Backend Developers) profile ( Full Time ) https://www.dhirubhai.net/company/creditdhara/ location - ( Kalkaji ) New Delhi if you are intersted then please notify me and share your updated resume. Company Name - Credit Dhara. If interested then notify me. It's urgent Hiring . 8368962287 Nikhil Vats Thanks

回复

要查看或添加评论,请登录

Prateek Tomar的更多文章