Created
June 14, 2019 09:36
-
-
Save Meowzz95/69502126352e63de8c2f1826f113770f to your computer and use it in GitHub Desktop.
Docker file extending official Jenkins image, add docker support(share host docker)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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