Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
In this blog post, I will try to show how to get a Jenkins server running on Docker.


Jenkins as stated in the documentation is -  A self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Docker is a set of PaaS products that uses OS level virtualisation to deliver software in packages called containers.

Now, lets get started -

Perquisite - Docker must be installed.

Getting Jenkins Run

Get the jenkins image from docker hub( using the command -
docker pull jenkins/jenkins

It will pull the latest jenkins image from the docker hub with all the libraries on to our local system. This is a fully functional Jenkins server, based on the weekly and LTS releases.

docker images will show the list of images in your locally repository along with the image id.

We can run the docker container using the command -
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts

In this command -p will publish the container’s port to the host i.e. 8080 port of the jenkins server running on docker. With this command we will get our jenkins server running on the docker container. BUT, the jenkins directory associated with this will be also on container and on deleting the container it will be lost.

This we can overcome by having a explicit volume(by using option -v to create a volume during docker run).
docker run -p 8080:8080 -p 50000:50000 -v /Users/Documents/jenkins_home:/var/jenkins_home jenkins/jenkins:lts

this will automatically create a folder 'jenkins_home' on the host machine, that will survive the container stop/restart/deletion.

We can also use docker volume instead of physical location.
docker volume create myvolume

docker run -p 8080:8080 -p 50000:50000 -v myvolume:/var/jenkins_home jenkins/jenkins:lts


On successful run, We will get Admin password(also can be found jenkins_home/secrets/initialAdminPassword) which will be used to login to Jenkins server.



Lets hit localhost:8080

After unlock, install plugins if needed, and then create username and password for the jenkins server.


Woahhh !!! Jenkins is ready to be used now...


Please note we can start or stop our jenkins server by its container id.

check for the container id of our jenkins server -

docker ps

Stop the server - docker stop <container_id>

Start again server -  docker start <container_id>


We have set up a Jenkins server on a Docker. With this way we can have more control over our server as we are using our own Docker containers. Jenkins server can be tweaked with more configurations as per our need with more control on our docker containers.

In future post, we will see how to set up scalable infrastructure to host our Jenkins server.