Sign inSign up

morgan404/jenkins-bundle

By morgan404

Updated about 2 years ago

Custom image of the official Jenkins LTS image, with Maven and Java 17 installed and pre-configured.

Image
Integration & delivery
Monitoring & observability
0

838

morgan404/jenkins-bundle repository overview

Custom Jenkins Docker Image with Maven and Java 17

This Docker image is based on the official Jenkins LTS image, with Maven and Java 17 installed. It is designed for users who need a ready-to-go Jenkins setup with Maven and Java pre-configured.

Installed Software
  • Jenkins: Based on the official jenkins/jenkins:lts Version 2.462.1 image.
  • Java: OpenJDK 17 (Headless).
  • Maven: Apache Maven 3.8.7.
Installed Plugins
  • Github: GitHub plugin Version 1.40.0.
  • Maven Integration: Maven Integration plugin Version 3.23 .
Java Version
# java -version
Output:
openjdk 17.0.12 2024-07-16
OpenJDK Runtime Environment Temurin-17.0.12+7 (build 17.0.12+7)
OpenJDK 64-Bit Server VM Temurin-17.0.12+7 (build 17.0.12+7, mixed mode)
Maven Version
# mvn -v
Output:
Apache Maven 3.8.7
Maven home: /usr/share/maven
Java version: 17.0.12, vendor: Debian, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "6.10.3-arch1-2", arch: "amd64", family: "unix"
How to Use This Image

Running the Jenkins Container

1- Create the directory to store Jenkins data:

mkdir ~/Documents/jenkins

2- To run the Jenkins container using this image, use the following command:

docker run --name jenkins \
  -h jenkins-server \
  -d -u 1000 \
  -p 8080:8080 -p 50000:50000 \
  -v ~/Documents/jenkins:/var/jenkins_home:rw \
  -v /etc/localtime:/etc/localtime \
  morgan404/jenkins-bundle:latest
Explanation of the Docker Run Command:
  • --name jenkins: Names the container "jenkins" for easy reference.
  • -h jenkins-server: Sets the hostname of the container to "jenkins-server."
  • -d: To run a Docker container in detached mode.
  • -u 1000: Runs Jenkins as a user with UID 1000 to avoid permission issues on the host.
  • -p 8080:8080: Maps Jenkins' web interface to port 8080 on the host.
  • -p 50000:50000: Maps the Jenkins slave agent port for distributed builds.
  • -v ~/Documents/jenkins:/var/jenkins_home:rw: Mounts the Jenkins home directory on the host, allowing data persistence across container restarts.
  • -v /etc/localtime:/etc/localtime: Syncs the container's time with the host machine.
Getting the Admin crednetial:
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword

The output

$ docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword                                                   
c46a3af45e8649f1b2a8b2d1ec0ba7bf
Data Persistence

The -v ~/Documents/jenkins:/var/jenkins_home:rw option mounts the Jenkins home directory to a location on your host machine. This ensures that Jenkins configuration, jobs, and plugins are stored persistently and will not be lost if the container is stopped or removed.

Building the Custom Image

If you want to build this custom image yourself, you can find the Dockerfile and source code on GitHub, Gitlab

Simply clone the repository and build the image using:

docker build -t my-jenkins:latest .

Tag summary

Content type

Image

Digest

sha256:fd94abd6d

Size

517 MB

Last updated

about 2 years ago

docker pull morgan404/jenkins-bundle