In this blog , We will explore how can we install Jenkins using docker .
Step -1 Run below command to pull jenkins image from docker hub repository.
docker pull jenkins/jenkins
Step-2 Run the jenkins image in docker container with name jenkins-master and map to port 8080
docker run -p 8080:8080 --name=jenkins-master -d jenkins/jenkins
Step-3 – By default Jenkins stores data into /var/jenkins_home . By mapping the volume of Jenkins directory (/var/jenkins_home) to home data directory inside container.
docker run -p 8080:8080 -v /Users/asif/jenkins-data:/var/jenkins_home -d jenkins/jenkins
Step-4 -Execute below command to find Administrator password for Jenkins.
docker logs containerId
In my case my container id starting from e772 .So I have replace my containerid below and use password marked with red colour below.
docker logs e772
Step-5 You will see below screen to install plugins to build/run pipelines. You can choose custom plugins or install suggested plugins.
Step-6 Create first admin user.
Step-7 – After creating user you should be able to login and create pipelines.