Running Jenkins as a Docker Container: Difference between revisions
(Created page with "=Internal= * Jenkins Operations =Overview= =Help= docker run --rm jenkins/jenkins:LTS --help =Run= The foll...") |
|||
(16 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Overview= | =Overview= | ||
One requirement when running Jenkins as a container is to write the content of [[Jenkins_Concepts#Instance_State|$JENKINS_HOME]] on an external [[Docker_Concepts#Data_Volume|data volume]]. One reason is that temporary files required by builds are written into $JENKINS_HOME: | |||
jenkins_home/workspace/test-build/.git/... | |||
=Image with Pre-Installed Recommended Plugins= | |||
The following Dockerfile builds an image that contains all recommended plugins, and [[Jenkins Docker Plugin#Overview|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: | |||
{{External|https://github.com/NovaOrdis/playground/blob/master/jenkins/docker/jenkins-with-plugins/Dockerfile}} | |||
Build it with: | |||
docker build -t jenkins-with-plugins . | |||
=Help= | =Help= | ||
docker run --rm jenkins | docker run --rm jenkins-with-plugins --help | ||
=Networking= | |||
If planning to execute Jenkins with a Docker plugin, while the Docker server is installed on a laptop with dynamic DHCP address, it may be necessary to start the Docker server in a non-default networking mode. For context, see [[Jenkins_Docker_Plugin#Docker_Hostname_or_IP_address|'Docker Hostname or IP address' configuration section of the Docker Plugin]]. | |||
=Run= | =Run= | ||
Line 13: | Line 31: | ||
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: | ||
{{External|https://github.com/NovaOrdis/playground/blob/master/jenkins/docker/jenkins-with-plugins/run}} | |||
The instance will be available at http://localhost:8080/ |
Latest revision as of 20:10, 1 May 2018
Internal
Overview
One requirement when running Jenkins as a container is to write the content of $JENKINS_HOME on an external data volume. One reason is that temporary files required by builds are written into $JENKINS_HOME:
jenkins_home/workspace/test-build/.git/...
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:
Build it with:
docker build -t jenkins-with-plugins .
Help
docker run --rm jenkins-with-plugins --help
Networking
If planning to execute Jenkins with a Docker plugin, while the Docker server is installed on a laptop with dynamic DHCP address, it may be necessary to start the Docker server in a non-default networking mode. For context, see 'Docker Hostname or IP address' configuration section of the Docker Plugin.
Run
The following command line assumes that the image was modified to maintain the plugin and WAR directories in custom locations:
The instance will be available at http://localhost:8080/