How to Install Jenkins on Docker - Little Big Extra Skip to main content

How to Install Jenkins on Docker

Installing Docker on Jenkins

Jenkins is a great tool to build and package artifacts, it can be either deployed independently as a service in docker, lets go through the steps required to install Jenkins on docker as a container.

In this tutorial, we will

    • Get Jenkins Docker Image from Docker Hub
    • Run the Docker Image
    • Configure Jenkins

Get official Jenkins Image

      • Go to your terminal/command prompt and get the Jenkins latest’s image from docker hub

Run Docker Image

Map localhost ports

        • Then we will try to run the image, we will map Jenkins on localhost port 8080 and port 50000
Port 8080 exposes the web interface and port 50000 gives you access to a remote Java (JIRA) API.

Map Volumes to persist data

      • If it is important to persist the Jenkins data you can choose between the 2 options.
        1. Save data within the docker container, the docker volume persists upon restarts and even after if the container is deleted.
        2. Save data on your host/disk/laptop/machine. Weigh in your requirements and see what fits in with your requirements.
      • Option-1> To persist the data within docker container

OR

      • Option-2>To persist the data within host( host machine/laptop) container(option-2)

        Don’t forget to change the path to your local drive  after -v tag /Users/…. in case of Mac and C:/Users…. in case of Windows)

Check Jenkins is running

        • Check if docker container Jenkins is running

          If all is fine, it should show output like below

Configure Jenkins

        • Go to Jenkins -> Globals tools configurations and add Java/GIT/Maven installations; download from the internet is an option which you can choose if there are no available installations on your disk as shown below.

Manage Jenkins

Add Maven and JDK

Related Posts

Leave a Reply

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

Bitnami