Skip to content

Instantly share code, notes, and snippets.

@a-shevtsov
Last active October 6, 2018 00:27
Show Gist options
  • Save a-shevtsov/e68d794d58279cd5136e179a1785da5a to your computer and use it in GitHub Desktop.
Save a-shevtsov/e68d794d58279cd5136e179a1785da5a to your computer and use it in GitHub Desktop.
Dockerized Jenkins with Docker
#!/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