bitnami/jenkins
Bitnami container image for Jenkins
5M+
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.
docker run --name jenkins bitnami/jenkins:latest
You can find the default credentials and available configuration options in the Environment Variables section.
Looking to use Jenkins in production? Try VMware Tanzu Application Catalog, the commercial edition of the Bitnami catalog.
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.
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.
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.
Dockerfile
linksLearn 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.
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 .
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/
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.
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
.
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
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.
Customizable environment variables
Name | Description | Default Value |
---|---|---|
JENKINS_HOME | Jenkins home directory. | ${JENKINS_VOLUME_DIR}/home |
JENKINS_PLUGINS | Comma-separated list of Jenkins plugins to be installed. | nil |
JENKINS_PLUGINS_LATEST | Set to false to install the minimum required version. | true |
JENKINS_PLUGINS_LATEST_SPECIFIED | Set to true to install the latest dependencies of any plugin that is requested to have the latest version. | false |
JENKINS_SKIP_IMAGE_PLUGINS | Set to true to skip the installation of image built-in plugins. | false |
JENKINS_OVERRIDE_PLUGINS | Set to true to force overriding existing plugins from the persisted volume. | false |
JENKINS_OVERRIDE_PATHS | Comma-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_ADDRESS | Jenkins HTTP listen address. | nil |
JENKINS_HTTPS_LISTEN_ADDRESS | Jenkins HTTPS listen address. | nil |
JENKINS_HTTP_PORT_NUMBER | Jenkins HTTP port number. | nil |
JENKINS_HTTPS_PORT_NUMBER | Jenkins HTTPS port number. | nil |
JENKINS_JNLP_PORT_NUMBER | Jenkins JNLP port number. | nil |
JENKINS_EXTERNAL_HTTP_PORT_NUMBER | Port to access Jenkins from outside of the instance using HTTP. | 80 |
JENKINS_EXTERNAL_HTTPS_PORT_NUMBER | Port to access Jenkins from outside of the instance using HTTPS. | 443 |
JENKINS_HOST | Jenkins hostname. | nil |
JENKINS_FORCE_HTTPS | Enable serving Jenkins through HTTPS instead of HTTP. | no |
JENKINS_SKIP_BOOTSTRAP | Whether to perform initial bootstrapping for the application. | no |
JENKINS_ENABLE_SWARM | Enable the Jenkins Swarm configuration. | no |
JENKINS_CERTS_DIR | Password of keystore. | ${JENKINS_HOME} |
JENKINS_KEYSTORE_PASSWORD | Password of keystore. | bitnami |
JENKINS_OPTS | Jenkins launcher parameters. | nil |
JENKINS_USERNAME | Jenkins admin user name. | user |
JENKINS_PASSWORD | Jenkins admin user password. | bitnami |
JENKINS_EMAIL | Jenkins admin user e-mail address. | user@example.com |
JENKINS_SWARM_USERNAME | Jenkins user for Swarm access name . | swarm |
JENKINS_SWARM_PASSWORD | Jenkins user for Swarm access password. | nil |
JAVA_HOME | Java Home directory. | ${BITNAMI_ROOT_DIR}/java |
JAVA_OPTS | Java options. | nil |
Read-only environment variables
Name | Description | Value |
---|---|---|
JENKINS_BASE_DIR | Jenkins installation directory. | ${BITNAMI_ROOT_DIR}/jenkins |
JENKINS_LOGS_DIR | Jenkins directory for log files. | ${JENKINS_BASE_DIR}/logs |
JENKINS_LOG_FILE | Path to the Jenkins log file. | ${JENKINS_LOGS_DIR}/jenkins.log |
JENKINS_TMP_DIR | Jenkins directory for runtime temporary files. | ${JENKINS_BASE_DIR}/tmp |
JENKINS_PID_FILE | Path to the Jenkins PID file. | ${JENKINS_TMP_DIR}/jenkins.pid |
JENKINS_TEMPLATES_DIR | Path to the directory containing templates to generate groovy scripts. | ${BITNAMI_ROOT_DIR}/scripts/jenkins/bitnami-templates |
JENKINS_VOLUME_DIR | Persistence base directory. | ${BITNAMI_VOLUME_DIR}/jenkins |
JENKINS_MOUNTED_CONTENT_DIR | Directory to mount custom Jenkins content (such as Groovy scripts or configuration files). | /usr/share/jenkins/ref |
JENKINS_DAEMON_USER | Jenkins system user. | jenkins |
JENKINS_DAEMON_GROUP | Jenkins system group. | jenkins |
JENKINS_DEFAULT_HTTP_LISTEN_ADDRESS | Default Jenkins HTTP listen address to enable at build time. | 0.0.0.0 |
JENKINS_DEFAULT_HTTPS_LISTEN_ADDRESS | Default Jenkins HTTPS listen address to enable at build time. | 0.0.0.0 |
JENKINS_DEFAULT_HTTP_PORT_NUMBER | Default Jenkins HTTP port number to enable at build time. | 8080 |
JENKINS_DEFAULT_HTTPS_PORT_NUMBER | Default Jenkins HTTPS port number to enable at build time. | 8443 |
JENKINS_DEFAULT_JNLP_PORT_NUMBER | Default 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
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.
To backup your data, configuration and logs, follow these simple steps:
Step 1: Stop the currently running container
$ docker-compose stop jenkins
$ 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 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
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.
docker pull bitnami/jenkins:latest
$ docker-compose stop jenkins
$ docker stop jenkins
Follow the steps in Backing up your container to take a snapshot of the current application state.
$ docker-compose rm -v jenkins
$ docker rm -v jenkins
$ docker-compose up jenkins
docker run --name jenkins bitnami/jenkins:latest
For customizations, please note that this image is, by default, a non-root container using the user jenkins
with uid=1001
.
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:
vim
editorFROM 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
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: trueJENKINS_PLUGINS_LATEST_SPECIFIED
: If set to true, install the latest dependencies of any plugin that is requested to have the latest version. Default: falseJENKINS_OVERRIDE_PLUGINS
: If set to true, existing plugins in the persisted volume will be removed and will force plugins to be reinstalled. Default: falseJENKINS_SKIP_IMAGE_PLUGINS
: If set to true, skip the installation of image built-in plugins. Default: falseYou 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
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
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:
JENKINS_SKIP_BOOTSTRAP
environment variable to yes
.JENKINS_HOME
that contains a functional Jenkins installation.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
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_