Bitnami Docker Image for Jenkins
In order to unify the approaches followed for Bitnami containers and Bitnami Helm charts, we are moving the different bitnami/bitnami-docker-<container>
repositories to a single monorepo bitnami/containers
. Please follow bitnami/containers to keep you updated about the latest Bitnami images.
More information here: https://blog.bitnami.com/2022/07/new-source-of-truth-bitnami-containers.html
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.
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.
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-jenkins/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
You can find the default credentials and available configuration options in the Environment Variables section.
DOCKER_CONTENT_TRUST=1
to verify the integrity of the images.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.
Dockerfile
linksLearn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.
Subscribe to project updates by watching the bitnami/jenkins 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.
$ docker build -t bitnami/jenkins:latest 'https://github.com/bitnami/bitnami-docker-jenkins.git#master:2/debian-11'
The main folder of this repository contains a functional docker-compose.yml
file. Run the application using it as shown below:
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-jenkins/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
If you want to run the application manually instead of using docker-compose
, these are the basic steps you need to run:
$ docker network create jenkins-network
$ 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
.
$ docker network create jenkins-network
$ docker run -d -p 80:8080 --name jenkins \
--network jenkins-network \
--volume /path/to/jenkins-persistence:/bitnami/jenkins \
bitnami/jenkins:latest
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
Available environment variables:
JENKINS_USERNAME
: Jenkins admin username. Default: user
JENKINS_PASSWORD
: Jenkins admin password. Default: bitnami
JENKINS_EMAIL
: Jenkins admin email. Default: [email protected]
JENKINS_HOME
: Jenkins home directory. Default: /bitnami/jenkins/home
JENKINS_HTTP_PORT_NUMBER
: Port used by Jenkins for HTTP. Default: 8080
JENKINS_HTTPS_PORT_NUMBER
: Port used by Jenkins for HTTPS. Default: 8443
JENKINS_EXTERNAL_HTTP_PORT_NUMBER
: Port to used by Jenkins to generate URLs and links when accessing using HTTP. Default: 80
JENKINS_EXTERNAL_HTTPS_PORT_NUMBER
: Port to used by Jenkins to generate URLs and links when accessing using HTTPS. Default: 443
JENKINS_JNLP_PORT_NUMBER
: Port used by Jenkins for JNLP. Default: 50000
JENKINS_FORCE_HTTPS
: Enable serving Jenkins only through HTTPS. Default: no
JENKINS_SKIP_BOOTSTRAP
: Skip performing the initial bootstrapping. Default: no
JAVA_OPTS
: Customize JVM parameters. No defaults.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:
$ docker-compose stop jenkins
$ docker stop jenkins
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/bitnami-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:
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
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, installing some plugins, 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).
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" \
--volume "$(pwd)/jenkins-init.groovy.d:/usr/share/jenkins/ref/init.groovy.d" \
bitnami/jenkins:latest
$ docker logs jenkins | grep world
--> hello world!
--> bye world!
config.xml
You can use your our own config.xml
file. However, using this feature will disable the default configuration generated by the Bitnami scripts. This is intended to customize the Jenkins configuration by code.
$ docker run -d -p 80:8080 --name jenkins \
--env "JENKINS_SKIP_BOOTSTRAP=yes" \
--volume "$(pwd)/config.xml:/usr/share/jenkins/ref/config.xml" \
bitnami/jenkins:latest
NOTE: The default
admin
user with this setup will not be created. It should be done separately.
JENKINS_ENABLE_HTTPS
has been renamed to JENKINS_FORCE_HTTPS
.install-plugins.sh
script has been deprecated. Instead use the Plugin Installation Manager Tool as explained in the Preinstalling Plugins section.DISABLE_JENKINS_INITIALIZATION
environment variable was renamed to JENKINS_SKIP_BOOTSTRAP
.root
user and the Jenkins service was started as the jenkins
user. From now on, both the container and the Jenkins service run as user jenkins
(uid=1001
). You can revert this behavior by changing USER 1001
to USER root
in the Dockerfile.jenkins
user has the appropriate permissions.We'd love for you to contribute to this container. You can request new features by creating an issue, or submit a pull request with your contribution.
If you encountered a problem running this container, you can file an issue. For us to provide better support, be sure to include the following information in your issue:
docker version
)docker info
Copyright © 2022 Bitnami
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.