Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
docker Jenkins reusable container
#! /bin/bash
# When running for first time, have empty directories; skip the setup by unchecking all plugins, etc.
# then shutdown jenkins, add old files and restart.
# If it fails, make sure the directory docker-volumes/jenkins and all its children are owned by same user, owner of the docker process.
# Or just chown -R on the jenkins directory.
docker run -it --name jenkins --network="permanet" --ip="172.30.0.6" \
-v /home/nikhil/.m2:/var/jenkins_home/.m2 \
-v /home/nikhil/.gradle:/var/jenkins_home/.gradle \
-v /home/nikhil/.npm:/var/jenkins_home/.npm \
-v /home/nikhil/docker-volumes/jenkins/workspace:/var/jenkins_home/workspace \
-v /home/nikhil/docker-volumes/jenkins/jobs:/var/jenkins_home/jobs \
-v /home/nikhil/docker-volumes/jenkins/plugins:/var/jenkins_home/plugins \
-v /home/nikhil/docker-volumes/jenkins/users:/var/jenkins_home/users \
-v /home/nikhil/docker-volumes/jenkins/tools:/var/jenkins_home/tools \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins/jenkins:lts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment