Run Jenkins LTS + Openshift Client + Docker in a container
1 min readApr 18, 2019
Recently I needed an environment to test my pipelines and a process to CI with Openshift, I was looking for an image with Jenkins, Docker, and Openshift Client and I couldn’t find then I created one and I will share.
Dockerfile
FROM docker.io/jenkins/jenkins:lts
USER root
COPY $PWD/oc /usr/local/bin/
RUN chmod +x /usr/local/bin/oc
RUN apt-get update -qq \
&& apt-get install -qqy apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
RUN apt-get update -qq \
&& apt-get install docker-ce=17.12.1~ce-0~debian -y
RUN usermod -aG docker jenkins
How to build image?
$ docker build --tag=myuser/jenkins:lts /path/to/dockerfile
How to run a container?
$ chown 1000 $PWD/jenkins
$ cd jenkins/$ docker run -d -p 49001:8080 -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/jenkins:/var/jenkins_home:z -t gloriapg/jenkins:lts
Source
Image in Dockerhub
docker pull gloriapg/jenkins:latest
Cheers folks!