Install docker if not installed: https://docs.docker.com/engine/install/
Pull Jenkins Image for docker hub:
RUN:
sudo docker pull jenkins/jenkins:lts-jdk17
Start a jenkins container in background at port 8080 with command:
RUN:
sudo docker run --rm --name jenkins -p 8080:8080 jenkins/jenkins:lts-jdk17
To access the jenkins server web UI
Check your machine ip adress:
RUN:
ifcongig
Copy the Ip address and open your web browser, the type:
http://your_IP:8080
A web UI will open up prompting for password
To get the password:
RUN:
sudo docker exec jenkinServer cat /var/jenkins_home/secrets/initialAdminPassword
Voila Jenkins server in now in your docker