What is Jenkins?
Jenkins is widely recognized as the most feature-rich CI available with easy configuration, continuous delivery and continuous integration support, easily test, build and stage your app, and more. It supports multiple SCM tools including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based projects as well as arbitrary scripts.
TL;DR;
Docker Compose
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-jenkins/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
Kubernetes
WARNING: This is a beta configuration, currently unsupported.
Get the raw URL pointing to the kubernetes.yml manifest and use kubectl to create the resources on your Kubernetes cluster like so:
$ kubectl create -f https://raw.githubusercontent.com/bitnami/bitnami-docker-jenkins/master/kubernetes.yml
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.
- Bitnami images are built on CircleCI and automatically pushed to the Docker Hub.
- All our images are based on minideb a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
Prerequisites
To run this application you need Docker Engine >= 1.10.0. Docker Compose is recommended with a version 1.6.0 or later.
How to use this image
Using Docker Compose
The recommended way to run Jenkins is using Docker Compose using the following docker-compose.yml template:
version: '2'
services:
jenkins:
image: 'bitnami/jenkins:latest'
ports:
- '80:8080'
- '443:8443'
volumes:
- 'jenkins_data:/bitnami'
volumes:
jenkins_data:
driver: local
Launch the containers using:
$ docker-compose up -d
Using the Docker Command Line
If you want to run the application manually instead of using docker-compose, these are the basic steps you need to run:
- Create a network
$ docker network create jenkins-tier
- Create volumes for Jenkins persistence and launch the container
$ docker volume create --name jenkins_data
$ docker run -d --name jenkins -p 80:8080 -p 443:8443 \
--net jenkins-tier \
--volume jenkins_data:/bitnami \
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 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
The following docker-compose.yml template demonstrates the use of host directories as data volumes.
version: '2'
services:
jenkins:
image: bitnami/jenkins:latest
ports:
- '80:8080'
- '443:8443'
volumes:
- /path/to/jenkins-persistence:/bitnami
Mount host directories as data volumes using the Docker command line
- Create a network (if it does not exist)
$ docker network create jenkins-tier
- Create the Jenkins the container with host volumes
$ docker run -d --name jenkins -p 80:8080 -p 443:8443 \
--net jenkins-tier \
--volume /path/to/jenkins-persistence:/bitnami \
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.
- Get the updated images:
$ docker pull bitnami/jenkins:latest
- Stop your container
- For docker-compose:
$ docker-compose stop jenkins - For manual execution:
$ docker stop jenkins
- Take a snapshot of the application state
$ rsync -a /path/to/jenkins-persistence /path/to/jenkins-persistence.bkp.$(date +%Y%m%d-%H.%M.%S)
You can use this snapshot to restore the application state should the upgrade fail.
- Remove the stopped container
- For docker-compose:
$ docker-compose rm -v jenkins - For manual execution:
$ docker rm -v jenkins
- Run the new image
- For docker-compose:
$ docker-compose start jenkins - For manual execution (mount the directories if needed):
docker run --name jenkins bitnami/jenkins:latest
Configuration
Environment variables
The Jenkins instance can be customized by specifying environment variables on the first run. The following environment values are provided to custom Jenkins:
JENKINS_USERNAME: Jenkins admin username. Default: userJENKINS_PASSWORD: Jenkins admin password. Default: bitnami
Specifying Environment variables using Docker Compose
version: '2'
services:
jenkins:
image: bitnami/jenkins:latest
ports:
- '80:8080'
- '443:8443'
environment:
- JENKINS_PASSWORD=my_password
volumes:
- jenkins_data:/bitnami
volumes:
jenkins_data:
driver: local
Specifying Environment variables on the Docker command line
$ docker run -d --name jenkins -p 80:8080 -p 443:8443 \
--net jenkins-tier \
--env JENKINS_PASSWORD=my_password \
--volume jenkins_data:/bitnami \
bitnami/jenkins:latest
Contributing
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.
Issues
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:
- Host OS and version
- Docker version (
docker version) - Output of
docker info - Version of this container (
echo $BITNAMI_IMAGE_VERSIONinside the container) - The command you used to run the container, and any relevant output you saw (masking any sensitive information)
Community
Most real time communication happens in the #containers channel at bitnami-oss.slack.com; you can sign up at slack.oss.bitnami.com.
Discussions are archived at bitnami-oss.slackarchive.io.
License
Copyright 2015-2017 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.