DevOps(1): Jenkins installation with docker:

HackPeas Freelancers
3 min readApr 22, 2022

In this blog, we will install the Jenkins tool in Linux ( Debian ) with docker, to do this, we must have any Linux distro installed with decent internet speed.

Jenkins

Jenkins is a tool for automation in DevOps, it is written in JAVA, open-source, and available in windows, mac, and Linux. it is used for continuous integration/Deployment of software/apps and code.

Installing Jenkins via docker image

  1. To do this, we need to install docker.io using the apt-get command.
$ apt-get install docker.io
hackpeas, Viraj Vaishnav, veer1024, hacker , devops, devsecops

I have already installed it.

2) I have created a docker image already. You can pull it by the following command

$ docker run hackpeas/jenkins-by-hackpeas:1.0.1

this will pull the docker image and save it locally

or you can also build your own docker image,

from ubuntu:20.04RUN apt-get update -y \ 
&& apt-get upgrade -y
RUN apt-get install openjdk-8-jdk -y
RUN apt-get install wget -y \
&& apt-get install gnupg -y \
&& wget -q -O — https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
RUN echo ‘deb https://pkg.jenkins.io/debian-stable binary/’ > /etc/apt/sources.list.d/jenkins.list
RUN apt-get update -y \
&& apt-get install jenkins -y \
&& apt-get install git -y
EXPOSE 8080
RUN ifconfig
#ENTRYPOINT [“service”,”jenkins”,”start”,”&”]
#CMD [“jenkins”,”start”,”&”]
#CMD [“/usr/sbin/service”,”jenkins”,”start”,”&”]

Copy the above code, and save it in a file with the name Dockerfile

then give the below command to create your own Jenkins image

$ docker build -t jenkins-by-hackpeas:1.0.1 .
Viraj Vaishnav, hackpeas , hacker , veer1024 , devsecops ,devops

to run the Jenkins

$ docker run -it hackpeas/jenkins-by-hackpeas:1.0.1

you will have a shell => check the IP

$ifconfig
hackpeas, Viraj Vaishnav , hacker, devops, devsecops

then start the Jenkins service

$ service jenkins start &

then visit http://IP_ADDRESS_OF_DOCKER:8080 in your host machine browser.

docker ,dockerhub , jenkins

3) the default password for Jenkins is stored in /var/lib/jenkins/secrets/initialAdminPassword

so what we can do is, we can cat this file for the password,

after entering the password, we have the below page

check the internet and then install suggested plugins, it will take a few minutes to setup

after the setup is finished, the following page will come

you need to fill the details

check the URL, make sure your IP is the same as your docker container

save and finish

Jenkins , linux , automation , docker , dockerhub

Now, if you want to save your work, then don’t forget to commit the docker container changes you made

$docker commit CONTAINER_ID IMAGE_NAME_YOU_WANT_TO_GIVE_NEW_MODIFIED_CONTAINER_IMAGE

For more DevOps, CTFs and bug bounty writeup, or content related to ethical hacking, android penetration testing. follow me on:

Youtube: https://www.youtube.com/channel/UC17W_Ircv7EmIIdbJeOQ_BQ
Instagram: https://www.instagram.com/hackpeas/
Linkedin: https://www.linkedin.com/in/viraj-vaishnav-19b0a61aa/
Twitter: https://twitter.com/VirajVaishnav16

Thank You..

--

--

HackPeas Freelancers

We provide the best technical services on a reasonable budget