Introducing our new CEO Don Johnson - Read More

bitnami/jenkins

Verified Publisher

By VMware

Updated 2 days ago

Bitnami container image for Jenkins

Image
Integration & Delivery
Developer Tools
75

5M+

Bitnami package for Jenkins

What is Jenkins?

Jenkins is an open source Continuous Integration and Continuous Delivery (CI/CD) server designed to automate the building, testing, and deploying of any software project.

Overview of Jenkins Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.

TL;DR

docker run --name jenkins bitnami/jenkins:latest

You can find the default credentials and available configuration options in the Environment Variables section.

Why use Bitnami Images?

  • Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
  • With Bitnami images the latest bug fixes and features are available as soon as possible.
  • Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
  • All our images are based on minideb -a minimalist Debian based container image that gives you a small base container image and the familiarity of a leading Linux distribution- or scratch -an explicitly empty image-.
  • All Bitnami images available in Docker Hub are signed with Notation. Check this post to know how to verify the integrity of the images.
  • Bitnami container images are released on a regular basis with the latest distribution packages available.

Looking to use Jenkins in production? Try VMware Tanzu Application Catalog, the commercial edition of the Bitnami catalog.

How to deploy Jenkins in Kubernetes?

Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the Bitnami Jenkins Chart GitHub repository.

Bitnami containers can be used with Kubeapps for deployment and management of Helm Charts in clusters.

Why use a non-root container?

Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.

Only latest stable branch maintained in the free Bitnami catalog

Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub.

Please check the Bitnami Premium page in our partner Arrow Electronics for more information.

Supported tags and respective Dockerfile links

Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.

You can see the equivalence between the different tags by taking a look at the tags-info.yaml file present in the branch folder, i.e bitnami/ASSET/BRANCH/DISTRO/tags-info.yaml.

Subscribe to project updates by watching the bitnami/containers GitHub repo.

Get this image

The recommended way to get the Bitnami Jenkins Docker Image is to pull the prebuilt image from the Docker Hub Registry.

docker pull bitnami/jenkins:latest

To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.

docker pull bitnami/jenkins:[TAG]

If you wish, you can also build the image yourself by cloning the repository, changing to the directory containing the Dockerfile and executing the docker build command. Remember to replace the APP, VERSION and OPERATING-SYSTEM path placeholders in the example command below with the correct values.

git clone https://github.com/bitnami/containers.git
cd bitnami/APP/VERSION/OPERATING-SYSTEM
docker build -t bitnami/APP:latest .

How to use this image

Using the Docker Command Line

Step 1: Create a network

docker network create jenkins-network

Step 2: Create volumes for Jenkins persistence and launch the container

$ docker volume create --name jenkins_data
docker run -d -p 80:8080 --name jenkins \
  --network jenkins-network \
  --volume jenkins_data:/bitnami/jenkins \
  bitnami/jenkins:latest

Access your application at http://your-ip/

Persisting your application

If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.

For persistence you should mount a volume at the /bitnami/jenkins path. The above examples define a docker volume namely jenkins_data. The Jenkins application state will persist as long as this volume is not removed.

To avoid inadvertent removal of this volume you can mount host directories as data volumes. Alternatively you can make use of volume plugins to host the volume data.

Mount host directories as data volumes with Docker Compose

This requires a minor change to the docker-compose.yml file present in this repository:

  ...
  services:
    jenkins:
    ...
    volumes:
-     - 'jenkins_data:/bitnami/jenkins
+     - /path/to/jenkins-persistence:/bitnami/jenkins
- volumes:
-   jenkins_data:
-     driver: local

NOTE: As this is a non-root container, the mounted files and directories must have the proper permissions for the UID 1001.

Mount host directories as data volumes using the Docker command line

Step 1: Create a network (if it does not exist)

docker network create jenkins-network

Step 2. Create the Jenkins container with host volumes

docker run -d -p 80:8080 --name jenkins \
  --network jenkins-network \
  --volume /path/to/jenkins-persistence:/bitnami/jenkins \
  bitnami/jenkins:latest
Using Docker Compose
curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/jenkins/docker-compose.yml > docker-compose.yml
docker-compose up -d

Please be aware this file has not undergone internal testing. Consequently, we advise its use exclusively for development or testing purposes. For production-ready deployments, we highly recommend utilizing its associated Bitnami Helm chart.

If you detect any issue in the docker-compose.yaml file, feel free to report it or contribute with a fix by following our Contributing Guidelines.

Configuration

Environment variables

Customizable environment variables

NameDescriptionDefault Value
JENKINS_HOMEJenkins home directory.${JENKINS_VOLUME_DIR}/home
JENKINS_PLUGINSComma-separated list of Jenkins plugins to be installed.nil
JENKINS_PLUGINS_LATESTSet to false to install the minimum required version.true
JENKINS_PLUGINS_LATEST_SPECIFIEDSet to true to install the latest dependencies of any plugin that is requested to have the latest version.false
JENKINS_SKIP_IMAGE_PLUGINSSet to true to skip the installation of image built-in plugins.false
JENKINS_OVERRIDE_PLUGINSSet to true to force overriding existing plugins from the persisted volume.false
JENKINS_OVERRIDE_PATHSComma-separated list of relative paths to be removed from the Jenkins home and recreated if present in the mounted content directory.nil
JENKINS_HTTP_LISTEN_ADDRESSJenkins HTTP listen address.nil
JENKINS_HTTPS_LISTEN_ADDRESSJenkins HTTPS listen address.nil
JENKINS_HTTP_PORT_NUMBERJenkins HTTP port number.nil
JENKINS_HTTPS_PORT_NUMBERJenkins HTTPS port number.nil
JENKINS_JNLP_PORT_NUMBERJenkins JNLP port number.nil
JENKINS_EXTERNAL_HTTP_PORT_NUMBERPort to access Jenkins from outside of the instance using HTTP.80
JENKINS_EXTERNAL_HTTPS_PORT_NUMBERPort to access Jenkins from outside of the instance using HTTPS.443
JENKINS_HOSTJenkins hostname.nil
JENKINS_FORCE_HTTPSEnable serving Jenkins through HTTPS instead of HTTP.no
JENKINS_SKIP_BOOTSTRAPWhether to perform initial bootstrapping for the application.no
JENKINS_ENABLE_SWARMEnable the Jenkins Swarm configuration.no
JENKINS_CERTS_DIRPassword of keystore.${JENKINS_HOME}
JENKINS_KEYSTORE_PASSWORDPassword of keystore.bitnami
JENKINS_OPTSJenkins launcher parameters.nil
JENKINS_USERNAMEJenkins admin user name.user
JENKINS_PASSWORDJenkins admin user password.bitnami
JENKINS_EMAILJenkins admin user e-mail address.user@example.com
JENKINS_SWARM_USERNAMEJenkins user for Swarm access name .swarm
JENKINS_SWARM_PASSWORDJenkins user for Swarm access password.nil
JAVA_HOMEJava Home directory.${BITNAMI_ROOT_DIR}/java
JAVA_OPTSJava options.nil

Read-only environment variables

NameDescriptionValue
JENKINS_BASE_DIRJenkins installation directory.${BITNAMI_ROOT_DIR}/jenkins
JENKINS_LOGS_DIRJenkins directory for log files.${JENKINS_BASE_DIR}/logs
JENKINS_LOG_FILEPath to the Jenkins log file.${JENKINS_LOGS_DIR}/jenkins.log
JENKINS_TMP_DIRJenkins directory for runtime temporary files.${JENKINS_BASE_DIR}/tmp
JENKINS_PID_FILEPath to the Jenkins PID file.${JENKINS_TMP_DIR}/jenkins.pid
JENKINS_TEMPLATES_DIRPath to the directory containing templates to generate groovy scripts.${BITNAMI_ROOT_DIR}/scripts/jenkins/bitnami-templates
JENKINS_VOLUME_DIRPersistence base directory.${BITNAMI_VOLUME_DIR}/jenkins
JENKINS_MOUNTED_CONTENT_DIRDirectory to mount custom Jenkins content (such as Groovy scripts or configuration files)./usr/share/jenkins/ref
JENKINS_DAEMON_USERJenkins system user.jenkins
JENKINS_DAEMON_GROUPJenkins system group.jenkins
JENKINS_DEFAULT_HTTP_LISTEN_ADDRESSDefault Jenkins HTTP listen address to enable at build time.0.0.0.0
JENKINS_DEFAULT_HTTPS_LISTEN_ADDRESSDefault Jenkins HTTPS listen address to enable at build time.0.0.0.0
JENKINS_DEFAULT_HTTP_PORT_NUMBERDefault Jenkins HTTP port number to enable at build time.8080
JENKINS_DEFAULT_HTTPS_PORT_NUMBERDefault Jenkins HTTPS port number to enable at build time.8443
JENKINS_DEFAULT_JNLP_PORT_NUMBERDefault Jenkins JNLP port number to enable at build time.50000

When you start the Jenkins image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. If you want to add a new environment variable:

  • For docker-compose add the variable name and value under the application section in the docker-compose.yml file present in this repository:

    jenkins:
      ...
      environment:
        - JENKINS_PASSWORD=my_password
      ...
    
  • For manual execution add a --env option with each variable and value:

    $ docker run -d -p 80:8080 --name jenkins \
      --env JENKINS_PASSWORD=my_password \
      --network jenkins-network \
      --volume /path/to/jenkins-persistence:/bitnami/jenkins \
      bitnami/jenkins:latest
    

Logging

The Bitnami Jenkins Docker image sends the container logs to stdout. To view the logs:

docker logs jenkins

Or using Docker Compose:

docker-compose logs jenkins

You can configure the containers logging driver using the --log-driver option if you wish to consume the container logs differently. In the default configuration docker uses the json-file driver.

Maintenance

Backing up your container

To backup your data, configuration and logs, follow these simple steps:

Step 1: Stop the currently running container

  • For docker-compose: $ docker-compose stop jenkins
  • For manual execution: $ docker stop jenkins

Step 2: Run the backup command

We need to mount two volumes in a container we will use to create the backup: a directory on your host to store the backup in, and the volumes from the container we just stopped so we can access the data.

docker run --rm -v /path/to/jenkins-backups:/backups --volumes-from jenkins bitnami/os-shell \
  cp -a /bitnami/jenkins /backups/latest
Restoring a backup

Restoring a backup is as simple as mounting the backup as volumes in the containers.

 $ docker run -d --name jenkins \
   ...
-  --volume /path/to/jenkins-persistence:/bitnami/jenkins \
+  --volume /path/to/jenkins-backups/latest:/bitnami/jenkins \
   bitnami/jenkins:latest
Upgrading Jenkins

Bitnami provides up-to-date versions of Jenkins, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container. We will cover here the upgrade of the Jenkins container.

Step 1. Get the updated images
docker pull bitnami/jenkins:latest
Step 2. Stop your container
  • For docker-compose: $ docker-compose stop jenkins
  • For manual execution: $ docker stop jenkins
Step 3. Take a snapshot of the application state

Follow the steps in Backing up your container to take a snapshot of the current application state.

Step 4. Remove the stopped container
  • For docker-compose: $ docker-compose rm -v jenkins
  • For manual execution: $ docker rm -v jenkins
Step 5. Run the new image
  • For docker-compose: $ docker-compose up jenkins
  • For manual execution (mount the directories if needed): docker run --name jenkins bitnami/jenkins:latest

Customize this image

For customizations, please note that this image is, by default, a non-root container using the user jenkins with uid=1001.

Extend this image

To extend the bitnami original image, you can create your own image using a Dockerfile with the format below:

FROM bitnami/jenkins
## Put your customizations below
...

Here is an example of extending the image with the following modifications:

  • Install the vim editor
FROM bitnami/jenkins

## Change user to perform privileged actions
USER 0
## Install 'vim'
RUN install_packages vim
## Revert to the original non-root user
USER 1001
Installing plugins

To download and install a set of plugins and their dependencies, use the Plugin Installation Manager tool. You can find information about how to use this tool in the guide below:

Alternatively, it is possible to install plugins using the following env variables:

  • JENKINS_PLUGINS: Comma-separated list of Jenkins plugins to be installed during the first boot.
  • JENKINS_PLUGINS_LATEST: If set to false, install the minimum required version of the plugins in JENKINS_PLUGINS. Default: true
  • JENKINS_PLUGINS_LATEST_SPECIFIED: If set to true, install the latest dependencies of any plugin that is requested to have the latest version. Default: false
  • JENKINS_OVERRIDE_PLUGINS: If set to true, existing plugins in the persisted volume will be removed and will force plugins to be reinstalled. Default: false
  • JENKINS_SKIP_IMAGE_PLUGINS: If set to true, skip the installation of image built-in plugins. Default: false
Passing JVM parameters

You might need to customize the JVM running Jenkins, typically to pass system properties or to tweak heap memory settings. Use the JAVA_OPTS environment variable for this purpose:

docker run -d --name jenkins -p 80:8080 \
  --env JAVA_OPTS=-Dhudson.footerURL=http://mycompany.com \
  bitnami/jenkins:latest
Using custom launcher parameters

In order to use custom parameters for Jenkins launcher, for example if you need to install Jenkins behind a reverse proxy with a prefix such as mycompany.com/jenkins, you can use the "JENKINS_OPTS" environment variable:

docker run -d --name jenkins -p 8080:8080 \
  --env JENKINS_OPTS="--prefix=/jenkins" \
  bitnami/jenkins:latest
Skipping Bitnami initialization

By default, when running this image, Bitnami implement some logic in order to configure it for working out of the box. This initialization consists of creating the user and password, preparing data to persist, configuring permissions, creating the JENKINS_HOME, etc. You can skip it in two ways:

  • Setting the JENKINS_SKIP_BOOTSTRAP environment variable to yes.
  • Attaching a volume with a custom JENKINS_HOME that contains a functional Jenkins installation.
Adding files/directories to the image

You can include files to the image automatically. All files/directories located in /usr/share/jenkins/ref are copied to /bitnami/jenkins/home (default Jenkins home directory).

Examples

Run groovy scripts at Jenkins start up

You can create custom groovy scripts and make Jenkins run them at start up.

However, using this feature will disable the default configuration done by the Bitnami scripts. This is intended to customize the Jenkins configuration by code.

$ mkdir jenkins-init.groovy.d
$ echo "println '--> hello world'" > jenkins-init.groovy.d/AA_hello.groovy
$ echo "println '--> bye world'" > jenkins-init.groovy.d/BA_bye.groovy

docker run -d -p 80:8080 --name jenkins \
  --env "JENKINS_SKIP_BOOTSTRAP=yes" \
  

_Note: the README for this container is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://github.com/bitnami/containers/blob/main/bitnami/jenkins/README.md_

Docker Pull Command

docker pull bitnami/jenkins
Bitnami