Install Jenkins on Docker

Prerequisite:

Verify Docker is already installed and running on your system.

docker version

To Install Docker download the Docker Desktop on Windows and follow the instructions here.

Installation Steps:

1. Create a bridge network in Docker using the following command:

docker network create jenkins

2. Create the following volumes to share the Docker client TLS certificates needed to connect to the Docker daemon and persist the Jenkins data using the following commands:

docker volume create jenkins-docker-certs
docker volume create jenkins-data

3. In order to execute Docker commands inside Jenkins nodes, download and run the docker:dind Docker image using the following command:

docker container 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 ^
  docker:dind

4. Download the jenkinsci/blueocean image and run it as a container in Docker using the following command:

docker container run --name jenkins-blueocean --rm  ^
  --network jenkins --env DOCKER_HOST=tcp://docker:2376 ^
  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 ^
  --volume jenkins-data:/var/jenkins_home ^
  --volume jenkins-docker-certs:/certs/client:ro ^
  --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean

Post Installation Steps:

1. Browse to http://localhost:8080 (or whichever port you configured for Jenkins when installing it) and wait until the Unlock Jenkins page appears.

2. From the Jenkins console log output, copy the automatically-generated alphanumeric password (between the 2 sets of asterisks).

3. On the Unlock Jenkins page, paste this password into the Administrator password field and click Continue.

4. After unlocking Jenkins, the Customize Jenkins page appears. Select Install suggested plugins

5. After plugins are install Create First Admin User page appears. Enter details and click on Save button.

6. Instance Configuration page appears. If you dont want to change Jenkins URL then click on Save and Finish button.

7. Jenkins is ready page appears. Click on Start using Jenkins button.

 

8. Jenkins Dashboard page is displayed.

 

 

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!