Running Jenkins as a Docker Container: Difference between revisions
Jump to navigation
Jump to search
(→Run) |
|||
Line 19: | Line 19: | ||
The following command line assumes that the image was modified to maintain [[Jenkins_Concepts#Instance_State|the plugin and WAR directories]] in custom locations: | The following command line assumes that the image was modified to maintain [[Jenkins_Concepts#Instance_State|the plugin and WAR directories]] in custom locations: | ||
docker run --rm -p 8080:8080 -v /var/lib/jenkins:/var/jenkins_home jenkins/ | <syntaxhighlight lang='bash'> | ||
#!/usr/bin/env bash | |||
docker run \ | |||
--rm \ | |||
--name jenkins \ | |||
-p 8080:8080 \ | |||
-v /Users/ovidiu/tmp/jenkins_home:/var/jenkins_home \ | |||
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \ | |||
jenkins-with-plugins | |||
docker run --rm -p 8080:8080 -v /var/lib/jenkins:/var/jenkins_home jenkins-with-plugins | |||
</syntaxhighlight> |
Revision as of 22:38, 24 April 2018
Internal
Overview
Image with Pre-Installed Recommended Plugins
The following Dockerfile builds an image that contains all recommended plugins, and Jenkins Docker Plugin. The image was configured so plugins and the WAR content will be part of the image, while $JENKINS_HOME is written on an external volume on the host system:
Help
docker run --rm jenkins/jenkins:LTS --help
Run
The following command line assumes that the image was modified to maintain the plugin and WAR directories in custom locations:
#!/usr/bin/env bash
docker run \
--rm \
--name jenkins \
-p 8080:8080 \
-v /Users/ovidiu/tmp/jenkins_home:/var/jenkins_home \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
jenkins-with-plugins
docker run --rm -p 8080:8080 -v /var/lib/jenkins:/var/jenkins_home jenkins-with-plugins