If you’re like me you know the process of bringing up a Java WAR app like Jenkins can be some what cumbersome if you have to go and hunt down the Oracle JDK. A rather clunky and manual set of pre-requisites, including setting environment variables like JAVA_HOME, while easy to do, introduces a lot more opportunities for getting side tracked while simply getting Jenkins installed.
Its situations like this where Vagrant and Docker are immensely useful. Assuming you can figure out how to get Docker installed (on mac its as simple as dragging an application to your applications folder) you really only need to do a small set of things.
- Open up terminal an do a
12mkdir jenkinsdocker run -p 8080:8080 -p 50000:50000 -v ~/jenkins:</code><code>/var/jenkins_home jenkins
- During the startup you will see an admin password you will need to copy to the clipboard. Now open up your browser and go to http://localhost:8080
- Give it the admin password and walk it through setup. Now you have jenkins installed in a container with ~/jenkins acting as the backing directory
When you’re done playing with Jenkins, bring down your docker image. Any time you want to play again just run
docker run -p 8080:8080 -p 50000:50000 -v ~/jenkins:</code><code>/var/jenkins_home jenkins
More Info: https://hub.docker.com/_/jenkins/