Skip to content

Commit

Permalink
Merge pull request #26 from clarsonneur/readme
Browse files Browse the repository at this point in the history
Update readme with dood info and few fixes
  • Loading branch information
clarsonneur authored Sep 11, 2018
2 parents 6f1b644 + 57c8a58 commit e9cc704
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ RUN chmod +x /bin/tini && \
# Retrieve list of embedded plugins in jenkins war file
# NOTE: for Jenkins 2.0 or latest, remove the embedded plugins before the feature.lst execution, to avoid plugin duplicates

ARG JENKINS_VERSION=1.642
ARG OS=redhat
ARG JENKINS_VERSION=1.642.4
ARG OS=redhat-stable
ADD https://pkg.jenkins.io/$OS/jenkins.repo /etc/yum.repos.d/jenkins.repo
RUN useradd -d "$JENKINS_HOME" -u 1000 -m -s /bin/bash jenkins && \
rpm --import https://pkg.jenkins.io/$OS/jenkins.io.key && \
Expand Down
69 changes: 57 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ Why?

We introduced several new features, like:
- [jenkins features](https://github.com/forj-oss/jenkins-install-inits) to help building easily a new jenkins image, by selecting some wanted features (Combination of plugins/config/scripts)
- a docker static binary cli to help doing Docker Out Of Docker.
- startup scripts capability
- Support for Docker out of Docker

# To run it
## To run it

Usually, you won't do that, because you want to build your own jenkins with the list of features you need. But if you want to see a basic version of jenkins, you can do the following:

```bash
docker run -it --rm -p 8080:8080 forjdevops/jenkins:latest_1.658
```

## Jenkins version and docker tags
### Jenkins version and docker tags

A docker image is versionned through his tag version and then pushed. Then on your Dockerfile, you refer to one version.

Ex:

```Dockerfile
FROM forjdevops/jenkins:latest_1.642
FROM forjdevops/jenkins:latest_1.6
```

We deliver several different jenkins version and maintain some of them.
Expand Down Expand Up @@ -55,24 +55,69 @@ To get a list of published and available versions, connect to [Docker Registry](

This project maintains a collection of tags, ie a limited collection of version of jenkins. To get the list of maintained version, read [releases.lst](releases.lst)

# To build your own Jenkins image
## To build your own Jenkins image

This is the most common use case.

Create a Dockerfile:

FROM forjdevops/jenkins:1.642
FROM forjdevops/jenkins:0.5_1.642.4

# To install plugins/features
COPY features.lst /tmp/
RUN /usr/local/bin/jenkins.sh /tmp/features.lst
# For possible features init files, see https://github.com/forj-oss/jenkins-install-inits
COPY jplugins.lst /tmp/
RUN /usr/local/bin/jplugin install /tmp/jplugins.lst
# For possible Jenkins features, see https://github.com/forj-oss/jenkins-install-inits

# Jenkins version
## Jenkins version

The Dockerfile currently install version Jenkins 1.642 LTS from RedHat jenkins Repository
The project manages and publish multiples jenkins version to docker hub. The publication to docker hub is controlled by `releases.lst` and executed by `bin/publish-alltags.sh`

# for more details about jenkins
You can build a single version, locally.

By default, the Dockerfile currently install version Jenkins 1.642.4 LTS from RedHat jenkins Repository.
But you can specify any version as soon as those vrrsion are available in Jenkins ([Stable](https://pkg.jenkins.io/redhat-stable/) or [latest](https://pkg.jenkins.io/redhat/))

`Latest` example: It will create a jenkins:test image
```bash
JENKINS_VERSION=2.141 bin/build.sh
```

`stable` example: It will create a jenkins:test image
```bash
JENKINS_VERSION=2.121.3 bin/build.sh '' redhat-stable
```

with a different tag: It will create a blabla:latest image
```bash
JENKINS_VERSION=2.121.3 bin/build.sh blabla redhat-stable
```

## Using Docker Out of Docker for your Jenkins master

If you are new to Docker or ask yourself about what is Docker Out of Docker (DooD), read this:

- [DinD vs DooD](http://blog.teracy.com/2017/09/11/how-to-use-docker-in-docker-dind-and-docker-outside-of-docker-dood-for-local-ci-testing/])
- Interesting article from Jérôme Petazzoni - [Do not use DinD for CI](https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/)

To enable it, do the following:

- at docker build:
1. Start your Jenkins image as `root` instead of `jenkins`

- At docker run:
1. Provide DOCKER_DOOD_GROUP, as the group ID of docker on the docker host

ex: docker run -it --rm **-e DOCKER_DOOD_GROUP=991** [...]

2. Provide the DooD mount

ex: docker run -it --rm **-v /var/run/docker.sock:/var/run/docker.sock** [...]

3. Optionnaly, mount a static docker client. Check https://download.docker.com/linux/static/stable/x86_64/

ex: docker run -it --rm **-v /home/centos/docker/docker:/bin/docker** [...]

## for more details about jenkins
See [public Docker image](https://hub.docker.com/r/library/jenkins/)

FORJ Team
Expand Down
6 changes: 3 additions & 3 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ else
fi
TAG_ARG="-t $TAG_NAME"

if [[ "$2" != "" ]]
if [[ "$2" != "redhat-stable" ]]
then
STABLE="--build-arg OS=$2"
OS="--build-arg OS=redhat"
fi

[[ ! -z $JENKINS_INSTALL_INITS_URL ]] && JENKINS_INSTALL_URL_FLAG="--build-arg JENKINS_INSTALL_INITS_URL=$JENKINS_INSTALL_INITS_URL"
Expand All @@ -63,4 +63,4 @@ fi
echo "-------------------------"
set -x
[ $PUSH = true ] && $DOCKER_CMD pull $TAG_NAME || echo "Building it from scratch"
$DOCKER_CMD build $PROXY $TAG_ARG $STABLE $JENKINS_VERSION_ARG $DOCKER_VERSION_ARG $JENKINS_INSTALL_URL_FLAG .
$DOCKER_CMD build $PROXY $TAG_ARG $OS $JENKINS_VERSION_ARG $DOCKER_VERSION_ARG $JENKINS_INSTALL_URL_FLAG .

0 comments on commit e9cc704

Please sign in to comment.