Jenkins - Docker Installation

1 - About

Jenkins installation on Docker

3 - Steps

3.1 - Create a container

Create an container and run it from the Community edition image

3.1.1 - Volume

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 \
   jenkins/jenkins:lts

3.1.2 - Bind

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 ^
   jenkins/jenkins:lts

where:

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

3.2 - Login

  • 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:

7ab9314d864540bcb474d35fe56943eb

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

3.3 - Reverse proxy

3.4 - 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


cd $ANT_HOME
ant -f fetch.xml -Ddest=system

  • Gradle
  • Mail Configuration

4 - 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 \
  jenkinsci/blueocean

5 - Documentation


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap