Skip to content

Instantly share code, notes, and snippets.

@Meowzz95

Meowzz95/Dockerfile

Created Jun 14, 2019
Embed
What would you like to do?
Docker file extending official Jenkins image, add docker support(share host docker)
FROM jenkins/jenkins:lts
# if we want to install via apt
USER root
ENV DOCKERVERSION=18.03.1-ce
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
RUN groupadd docker
RUN usermod -aG docker jenkins
RUN chmod -v a+s $(which docker)
# drop back to the regular jenkins user - good practice
USER jenkins
@Meowzz95

This comment has been minimized.

Copy link
Owner Author

@Meowzz95 Meowzz95 commented Jun 14, 2019

And use this to run

docker run -d \
-v jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 8089:8080 -p 50000:50000 \
-e JENKINS_OPTS="--prefix=/devops" \
--name my-jenkins \
my-jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.