Tech bytes# Running Jenkins in a Docker Container

Tech bytes# Running Jenkins in a Docker Container

Would you like to use Jenkins in your machine and don't want to follow the traditional installation process ? If your say YES - then follow along this brief article !


This article assumes you have some idea of what docker is and how to use it. The pre-requisites to get started are:

  • Docker running in your machine

If you are completely new to docker, I would highly recommend starting from here.

Installation Steps:

  • Create a folder called build and add a Dockerfile in it with content as below.
# build/Dockerfile
FROM jenkins/jenkins:lts-alpine

USER root 
RUN apk add docker
  • Create a docker-compose.yml as below:

version: "3.8"

    build: build/
      - 8090:8080
      - ""
      - "/var/run/docker.sock:/var/run/docker.sock"

  • Run the below command to start the service:
docker-compose up -d
  • Open the browser at:
  • We get a jenkins screens as below for the initial administrator password


  • Get the password from:
docker-compose exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword
  • After entering the password from above step, Jenkins shows the plugin selection screen.

Jenkins Plugin Screen

After the successful installation of the required plugins you will be redirected to Jenkins Dashboard page. You may create an admin user if required.

Jenkins Dashboard

That's it. You can use Jenkins now to create and run jobs as long as the container is running :)

Did you find this article valuable?

Support Rakesh Vardan by becoming a sponsor. Any amount is appreciated!