Jenkins - Docker Installation

Card Puncher Data Processing


Jenkins installation on Docker


Create a container

Create an container and run it from the Community edition image


Docker - Volume Mount

docker run -d \
   --name jenkins \
   -p 8081:8080 \
   -p 50000:50000 \
   -v jenkins_home:/var/jenkins_home \
   -v /var/run/docker.sock:/var/run/docker.sock \


Docker - Bind mount on Windows mounting JENKINS_HOME to a local directory (in our example to D:\jenkins_home)

# The jenkins home
mkdir D:\jenkins_home
# Just to send data
mkdir D:\backup
cd /D D:\jenkins_home
docker run -d ^
   --name jenkins ^
   -p 8081:8080 ^
   -p 50000:50000 ^
   -v %cd%:/var/jenkins_home ^
   -v d:\backup:/backup ^
   -v /var/run/docker.sock:/var/run/docker.sock ^
   --env JAVA_OPTS="-Dmail.smtp.starttls.enable=true" ^
   --restart always ^


  • the JAVA_OPTS is to enable TLS
  • restart is to restart the container on the start of docker


  • Admin Password can be seen in the log or at JENKINS_HOME/secrets/initialAdminPassword
docker logs jenkins
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:


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

Jenkins Unlock

Reverse proxy

HTTP - Gateway (Reverse Proxy)

Tools and configuration

Install the tools

Manage Jenkins > Global Tools Configuration:

  • Java - Add the local JDK. On docker, to get the path
docker exec -it jenkins bash
which java
# /opt/java/openjdk
ant -f fetch.xml -Ddest=system
  • Gradle
  • Mail Configuration

Blue ocean

  • Blue Ocean version (The new UI)
docker run \
  --name jenkins \
  -u root \
  -p 8080:8080 \
  -v jenkins-data:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v "$HOME":/home \


Discover More
Card Puncher Data Processing
Jenkins - Docker Plugin

docker plugin Doc ! Build Step: Docker Workflow Plugin: ...
Which Nohup
Jenkins - Installation / Configuration

Choice: Docker Windows Local next-executions You may get this error: You need to add the docker variable to the user running Jenkins...

Share this page:
Follow us:
Task Runner