Installing and Setting up Jenkins through Docker

Jenkins is written in Java and is a scalable, highly efficient open source automation server which runs using various plugins designed for continuous integration, deployment and automation purposes. Any new language, framework or tool can be easily setup on Jenkins using these plugins. Jenkins is platform independent, easily configurable, customizable for any project we come up with and has a rich plugin ecosystem.

This post covers installation and setting up of Jenkins Server through Docker and talks about various features of dashboard.

Setting up Jenkins

The following steps will show how to setup a Jenkins host on your computer running Ubuntu OS.

  1. Open a terminal, run the docker command to make sure it’s running. If not, start it using the below command (1) and verify status (2) :
    1. sudo systemctl start docker
    2. sudo systemctl status docker
  2. Run the following command as shown in the screenshot below :Screenshot from 2018-10-06 23-55-41The above command pulls Jenkins image and runs Jenkins in the Docker container built from this image.

Unable to find image ‘jenkinsci/blueocean:latest’ locally
latest: Pulling from jenkinsci/blueocean
4fe2ade4980c: Pull complete
6fc58a8d4ae4: Pull complete
fe815adf554b: Pull complete
f76236630288: Pull complete
8039171c0e57: Pull complete
18d8e90ec574: Pull complete
7a2a4ab0865c: Pull complete
0e70b771820a: Pull complete
6e7e196001ad: Pull complete
c63c334888d6: Pull complete
1dd6901c0bea: Pull complete
ca93531eb098: Pull complete
4d0f9ddcdde1: Pull complete
9a912b50042f: Pull complete
979f904978de: Pull complete
5c0e3c2efea2: Pull complete
Digest: sha256:b7135a71c62bbf11148944037417a2aae9e940ebc4cc7c3438a6b8c29a73d9f9
Status: Downloaded newer image for jenkinsci/blueocean:latest
Running from: /usr/share/jenkins/jenkins.war

Visit http://localhost:8080 to enter the initial admin password which can be fetched from container logs, by identifying the ID.

Screenshot from 2018-10-07 00-10-58

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

<password>

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

Enter this password in the browser prompt and we’re ready to customize Jenkins. Select Install Suggested Plugins and it will install the required ones. Once the plugin setup is complete you will be asked to create an Admin user. Fill in the details and click Save and Finish. Jenkins is now ready !

Screenshot from 2018-10-07 00-34-51

Dashboard

Jenkins Dashboard

When you first login to Jenkins you don’t have jobs or builds, on the top right corner there is an option to add short description. The bottom right corner has a REST API section, with some details on how to interact with Jenkins API.

Management

On the left hand side of dashboard, Open Manage Jenkins and select Configure Global Security settings. By default, we should have security enabled and realm is Jenkins’ Own User Database. When more than one user is present in that case we should have Authorization set to different options, other than default.

Matrix-Based security –  It allows administrators to grant permissions to various groups depending upon the context. Here, I have selected this option and added new user account by granting various permissions, which can be seen below :Screenshot from 2018-10-07 00-39-20

So, we have identified important points on how to setup Jenkins server through Docker and have gained some insight on user management and access control.

 

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: