Install docker and docker compose plugin.
docker pull jenkins/jenkins
To know where docker is saving the executable
docker info | grep -i root
Space docker is taking
sudo du -sh /var/lib/docker
Create a directory jenkins-data in home directory.
List images from docker
docker images
Copy REPOSITORY name of jenkins
version: '2'
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins
ports:
- "8080:8080"
volumes:
- "$PWD/jenkins_home:/var/jenkins_home"
networks:
- net
networks:
net:
sudo chown 1000:1000 jenkins_home -R
if you get error regarding $PWD
then replace $PWD
with .
Now, run the jenkins image:
docker compose up
This will start docker image.
Now, hit 127.0.0.1:8080
from browser and password will be seen in the terminal logs.
If you missed the password then do
docker logs jenkins -f