Adds additional tools to the official jenkins docker.
i.e. Jenkins Docker building Dockers
Create a Volume Docker
docker run --name jenkins-data -v /var/jenkins_home busybox sh -c "mkdir -p /var/jenkins_home; chown 1000:1000 /var/jenkins_home"
Start Jenkins with docker support:
docker run -d --name jenkins -p 50000:50000 -e DOCKER_GID=`grep "^docker" /etc/group|cut -d: -f3` -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock --volumes-from jenkins-data coderfi/jenkins-plus
The container will set the container's docker group id to the
DOCKER_GID env. Be sure this matches the host's docker group id, otherwise
the jenkins process will not have permission to run docker commands!
recommended Jenkins plugins
about the build
I wanted to build docker images via Jenkins on a CoreOS host OS.
I quickly found the official Jenkins docker to accomplish this, however, I also quickly found out
docker package was lacking from this image.
In order to run docker commands, we mount the host's
To run a docker command, the user must either be
root, or be part of the
The official Jenkins docker sets the default User to be
As you can see from the
Dockerfile, we add the
jenkins user to the
Unfortunately, the docker's
docker group is not the same as the host's
So, what we do is hack the docker's
docker group id to match the host's
docker group id,
which is specified by the
DOCKER_GID environment variable.
Now I can deploy a Jenkins master node running inside a docker container on my CoreOS installation,
and use Jenkins as part of my Continuous Integration strategy building other dockers.