Last active
October 6, 2018 00:27
-
-
Save a-shevtsov/e68d794d58279cd5136e179a1785da5a to your computer and use it in GitHub Desktop.
Dockerized Jenkins with 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
#!/usr/bin/env bash | |
JENKINS_VERSION=2.89.4 | |
JENKINS_HOME_VOLUME=jenkins_home | |
docker run -d --rm \ | |
--name jenkins \ | |
-p 8080:8080 \ | |
-p 50000:50000 \ | |
-v ${JENKINS_HOME_VOLUME}:/var/jenkins_home \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
h1kkan/jenkins-docker:${JENKINS_VERSION} | |
# Match ID of the docker group inside the container so it can use host's Docker daemon | |
docker exec --user root jenkins groupmod -g $(grep docker /etc/group | cut -d':' -f3) docker | |
# Restart Jenkins to apply the GID change | |
docker restart jenkins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment