01: Getting started with Jenkins on Docker tutorial

Jenkins is the most popular CI/CD server. There you create jobs that are triggered by some events (changed in a code repository, manually, etc). Those events invokes the steps like compiling to see if you can generate the executable. Then you run tests (unit tests) to confirm the desired behaviour at low-level. After the integration stage passes, you can build the executable to deliver them to a working environment.

Step 1: Install & start Docker container. If the image is not already available it will be downloaded from “Docker Hub”, i.e. https://hub.docker.com/ where you can search for the image “jenkins”.

Step 2: Get into the container and check for “/var/jenkins_home/secrets/initialAdminPassword

Show the password:

Copy and paste the password on the Web UI in the next step.

Step 3: Open the Jenkins Web UI and paste password from last step.

Jenkins Admin

Jenkins Admin

Step 4: Install the suggested packages.

Jenkins Install suggested packages

Jenkins Install suggested packages

Step 5: Create an admin user with a password in the ensuing screens, and then you are ready to use Jenkins as shown below.

Welcome to Jenkins

Welcome to Jenkins

Step 6: Click on “New Item” menu within Jenkins, and type “test” and select “Freestyle project“.

Multibranch pipeline

Freestyle project

Step 7: Go to the “Build” tab and in “Add build step” list select “Execute shell“.

Step 8: Enter some shell commands & click “save“.

Freestyle project - Execute shell

Freestyle project – Execute shell

Step 9: Click on the “Build Now” to build the project.

Freestyle project - Build Now

Freestyle project – Build Now

Step 10: Click on the build number as in “#4”, and the select “Console Output“.

Jenkins Job - Console Output

Jenkins Job – Console Output

Step 11: Get yourself familiarised by clicking on the “Configure” and playing around with various things.

What is next?

02: Getting started with Jenkins Multibranch pipeline on Docker tutorial. Most industrial applications will be using this as there will be many branches.

300+ Java Developer Interview Q&As

800+ Java Interview Q&As