{"id":23034131,"url":"https://github.com/autostructure/jenkins","last_synced_at":"2025-04-02T22:15:13.881Z","repository":{"id":136317266,"uuid":"169564925","full_name":"autostructure/jenkins","owner":"autostructure","description":"Jenkins image with Docker binaries","archived":false,"fork":false,"pushed_at":"2019-02-25T18:46:52.000Z","size":411,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T12:45:51.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/autostructure.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-07T12:00:02.000Z","updated_at":"2019-02-25T18:46:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"25563502-ddf9-4cbf-88bf-583a110c5f53","html_url":"https://github.com/autostructure/jenkins","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autostructure%2Fjenkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autostructure%2Fjenkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autostructure%2Fjenkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autostructure%2Fjenkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autostructure","download_url":"https://codeload.github.com/autostructure/jenkins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899668,"owners_count":20851898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-15T16:29:22.605Z","updated_at":"2025-04-02T22:15:13.861Z","avatar_url":"https://github.com/autostructure.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Official Jenkins Docker image\n\nThe Jenkins Continuous Integration and Delivery server [available on Docker Hub](https://hub.docker.com/r/jenkins/jenkins).\n\nThis is a fully functional Jenkins server.\n[https://jenkins.io/](https://jenkins.io/).\n\n\u003cimg src=\"https://jenkins.io/sites/default/files/jenkins_logo.png\"/\u003e\n\n\n# Usage\n\n```\ndocker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts\n```\n\nNOTE: read below the _build executors_ part for the role of the `50000` port mapping.\n\nThis will store the workspace in /var/jenkins_home. All Jenkins data lives in there - including plugins and configuration.\nYou will probably want to make that an explicit volume so you can manage it and attach to another container for upgrades :\n\n```\ndocker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts\n```\n\nthis will automatically create a 'jenkins_home' [docker volume](https://docs.docker.com/storage/volumes/) on the host machine, that will survive the container stop/restart/deletion.\n\nNOTE: Avoid using a [bind mount](https://docs.docker.com/storage/bind-mounts/) from a folder on the host machine into `/var/jenkins_home`, as this might result in file permission issues (the user used inside the container might not have rights to the folder on the host machine). If you _really_ need to bind mount jenkins_home, ensure that the directory on the host is accessible by the jenkins user inside the container (jenkins user - uid 1000) or use `-u some_other_user` parameter with `docker run`.\n\n```\ndocker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts\n```\n\nthis will run Jenkins in detached mode with port forwarding and volume added. You can access logs with command 'docker logs CONTAINER_ID' in order to check first login token. ID of container will be returned from output of command above. \n\n## Backing up data\n\nIf you bind mount in a volume - you can simply back up that directory\n(which is jenkins_home) at any time.\n\nThis is highly recommended. Treat the jenkins_home directory as you would a database - in Docker you would generally put a database on a volume.\n\nIf your volume is inside a container - you can use ```docker cp $ID:/var/jenkins_home``` command to extract the data, or other options to find where the volume data is.\nNote that some symlinks on some OSes may be converted to copies (this can confuse jenkins with lastStableBuild links etc)\n\nFor more info check Docker docs section on [Managing data in containers](https://docs.docker.com/engine/tutorials/dockervolumes/)\n\n# Setting the number of executors\n\nYou can specify and set the number of executors of your Jenkins master instance using a groovy script. By default its set to 2 executors, but you can extend the image and change it to your desired number of executors :\n\n`executors.groovy`\n```\nimport jenkins.model.*\nJenkins.instance.setNumExecutors(5)\n```\n\nand `Dockerfile`\n\n```\nFROM jenkins/jenkins:lts\nCOPY executors.groovy /usr/share/jenkins/ref/init.groovy.d/executors.groovy\n```\n\n\n# Attaching build executors\n\nYou can run builds on the master out of the box.\n\nBut if you want to attach build slave servers **through JNLP (Java Web Start)**: make sure you map the port: ```-p 50000:50000``` - which will be used when you connect a slave agent.\n\nIf you are only using [SSH slaves](https://wiki.jenkins-ci.org/display/JENKINS/SSH+Slaves+plugin), then you do **NOT** need to put that port mapping.\n\n# Passing JVM parameters\n\nYou might need to customize the JVM running Jenkins, typically to pass system properties or tweak heap memory settings. Use JAVA_OPTS environment\nvariable for this purpose :\n\n```\ndocker run --name myjenkins -p 8080:8080 -p 50000:50000 --env JAVA_OPTS=-Dhudson.footerURL=http://mycompany.com jenkins/jenkins:lts\n```\n\n# Configuring logging\n\nJenkins logging can be configured through a properties file and `java.util.logging.config.file` Java property.\nFor example:\n\n```\nmkdir data\ncat \u003e data/log.properties \u003c\u003cEOF\nhandlers=java.util.logging.ConsoleHandler\njenkins.level=FINEST\njava.util.logging.ConsoleHandler.level=FINEST\nEOF\ndocker run --name myjenkins -p 8080:8080 -p 50000:50000 --env JAVA_OPTS=\"-Djava.util.logging.config.file=/var/jenkins_home/log.properties\" -v `pwd`/data:/var/jenkins_home jenkins/jenkins:lts\n```\n\n# Configuring reverse proxy\nIf you want to install Jenkins behind a reverse proxy with prefix, example: mysite.com/jenkins, you need to add environment variable `JENKINS_OPTS=\"--prefix=/jenkins\"` and then follow the below procedures to configure your reverse proxy, which will depend if you have Apache or Nginx:\n- [Apache](https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache)\n- [Nginx](https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy)\n\n# Passing Jenkins launcher parameters\n\nArgument you pass to docker running the jenkins image are passed to jenkins launcher, so you can run for sample :\n```\ndocker run jenkins/jenkins:lts --version\n```\nThis will dump Jenkins version, just like when you run jenkins as an executable war.\n\nYou also can define jenkins arguments as `JENKINS_OPTS`. This is usefull to define a set of arguments to pass to jenkins launcher as you\ndefine a derived jenkins image based on the official one with some customized settings. The following sample Dockerfile uses this option\nto force use of HTTPS with a certificate included in the image\n\n```\nFROM jenkins/jenkins:lts\n\nCOPY https.pem /var/lib/jenkins/cert\nCOPY https.key /var/lib/jenkins/pk\nENV JENKINS_OPTS --httpPort=-1 --httpsPort=8083 --httpsCertificate=/var/lib/jenkins/cert --httpsPrivateKey=/var/lib/jenkins/pk\nEXPOSE 8083\n```\n\nYou can also change the default slave agent port for jenkins by defining `JENKINS_SLAVE_AGENT_PORT` in a sample Dockerfile.\n\n```\nFROM jenkins/jenkins:lts\nENV JENKINS_SLAVE_AGENT_PORT 50001\n```\nor as a parameter to docker,\n```\ndocker run --name myjenkins -p 8080:8080 -p 50001:50001 --env JENKINS_SLAVE_AGENT_PORT=50001 jenkins/jenkins:lts\n```\n\n# Installing more tools\n\nYou can run your container as root - and install via apt-get, install as part of build steps via jenkins tool installers, or you can create your own Dockerfile to customise, for example:\n\n```\nFROM jenkins/jenkins:lts\n# if we want to install via apt\nUSER root\nRUN apt-get update \u0026\u0026 apt-get install -y ruby make more-thing-here\n# drop back to the regular jenkins user - good practice\nUSER jenkins\n```\n\nIn such a derived image, you can customize your jenkins instance with hook scripts or additional plugins.\nFor this purpose, use `/usr/share/jenkins/ref` as a place to define the default JENKINS_HOME content you\nwish the target installation to look like :\n\n```\nFROM jenkins/jenkins:lts\nCOPY custom.groovy /usr/share/jenkins/ref/init.groovy.d/custom.groovy\n```\n\n## Preinstalling plugins\n\nYou can rely on the `install-plugins.sh` script to pass a set of plugins to download with their dependencies.\nThis script will perform downloads from update centers, and internet access is required for the default update centers.\n\n### Setting update centers\n\nDuring the download, the script will use update centers defined by the following environment variables:\n\n* `JENKINS_UC` - Main update center.\n  This update center may offer plugin versions depending on the Jenkins LTS Core versions.\n  Default value: https://updates.jenkins.io\n* `JENKINS_UC_EXPERIMENTAL` - [Experimental Update Center](https://jenkins.io/blog/2013/09/23/experimental-plugins-update-center/).\n  This center offers Alpha and Beta versions of plugins.\n  Default value: https://updates.jenkins.io/experimental\n* `JENKINS_INCREMENTALS_REPO_MIRROR` -\n  Defines Maven mirror to be used to download plugins from the\n  [Incrementals repo](https://jenkins.io/blog/2018/05/15/incremental-deployment/).\n  Default value: https://repo.jenkins-ci.org/incrementals\n\nIt is possible to override the environment variables in images.\n\n:exclamation: Note that changing this variables **will not** change the Update Center being used by Jenkins runtime.\n\n### Plugin version format\n\nUse plugin artifact ID, without `-plugin` extension, and append the version if needed separated by `:`.\nDependencies that are already included in the Jenkins war will only be downloaded if their required version is newer than the one included.\n\nThere are also custom version specifiers:\n\n* `latest` - download the latest version from the main update center.\n  For Jenkins LTS images\n  (example: `git:latest`)\n* `experimental` - download the latest version from the experimental update center defined by the `JENKINS_UC_EXPERIMENTAL` environment variable (example: `filesystem_scm:experimental`)\n* `incrementals;org.jenkins-ci.plugins.workflow;2.19-rc289.d09828a05a74[;githubUserId][;branchName]`\n- download the plugin from the [Incrementals repo](https://jenkins.io/blog/2018/05/15/incremental-deployment/).\n  * For this option you need to specify `groupId` of the plugin.\n    Note that this value may change between plugin versions without notice.\n  * In order to automatically update Incrementals in plugins.txt, it is possible to use the Incrementals Maven Plugin:\n    `mvn incrementals:updatePluginsTxt -DpluginsFile=plugins.txt`.\n    [More Info](https://github.com/jenkinsci/incrementals-tools#updating-versions-for-jenkins-docker-images)\n\n### Script usage\n\nYou can run the script manually in Dockerfile:\n\n```Dockerfile\nFROM jenkins/jenkins:lts\nRUN /usr/local/bin/install-plugins.sh docker-slaves github-branch-source:1.8\n```\n\nFurthermore it is possible to pass a file that contains this set of plugins (with or without line breaks).\n\n```Dockerfile\nFROM jenkins/jenkins:lts\nCOPY plugins.txt /usr/share/jenkins/ref/plugins.txt\nRUN /usr/local/bin/install-plugins.sh \u003c /usr/share/jenkins/ref/plugins.txt\n```\n\nWhen jenkins container starts, it will check `JENKINS_HOME` has this reference content, and copy them\nthere if required. It will not override such files, so if you upgraded some plugins from UI they won't\nbe reverted on next start.\n\nIn case you *do* want to override, append '.override' to the name of the reference file. E.g. a file named\n`/usr/share/jenkins/ref/config.xml.override` will overwrite an existing `config.xml` file in JENKINS_HOME.\n\nAlso see [JENKINS-24986](https://issues.jenkins-ci.org/browse/JENKINS-24986)\n\n\nHere is an example to get the list of plugins from an existing server:\n\n```\nJENKINS_HOST=username:password@myhost.com:port\ncurl -sSL \"http://$JENKINS_HOST/pluginManager/api/xml?depth=1\u0026xpath=/*/*/shortName|/*/*/version\u0026wrapper=plugins\" | perl -pe 's/.*?\u003cshortName\u003e([\\w-]+).*?\u003cversion\u003e([^\u003c]+)()(\u003c\\/\\w+\u003e)+/\\1 \\2\\n/g'|sed 's/ /:/'\n```\n\nExample Output:\n\n```\ncucumber-testresult-plugin:0.8.2\npam-auth:1.1\nmatrix-project:1.4.1\nscript-security:1.13\n...\n```\n\nFor 2.x-derived images, you may also want to\n\n    RUN echo 2.0 \u003e /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state\n\nto indicate that this Jenkins installation is fully configured.\nOtherwise a banner will appear prompting the user to install additional plugins,\nwhich may be inappropriate.\n\n# Upgrading\n\nAll the data needed is in the /var/jenkins_home directory - so depending on how you manage that - depends on how you upgrade. Generally - you can copy it out - and then \"docker pull\" the image again - and you will have the latest LTS - you can then start up with -v pointing to that data (/var/jenkins_home) and everything will be as you left it.\n\nAs always - please ensure that you know how to drive docker - especially volume handling!\n\n## Upgrading plugins\n\nBy default, plugins will be upgraded if they haven't been upgraded manually and if the version from the docker image is newer than the version in the container. Versions installed by the docker image are tracked through a marker file.\n\nThe default behaviour when upgrading from a docker image that didn't write marker files is to leave existing plugins in place. If you want to upgrade existing plugins without marker you may run the docker image with `-e TRY_UPGRADE_IF_NO_MARKER=true`. Then plugins will be upgraded if the version provided by the docker image is newer.\n\n# Building\n\nBuild with the usual\n\n    docker build -t jenkins/jenkins .\n\nTests are written using [bats](https://github.com/sstephenson/bats) under the `tests` dir\n\n    DOCKERFILE=Dockerfile bats tests\n    DOCKERFILE=Dockerfile-alpine bats tests\n\nDownload the test helpers by updating the submodules\n    \n    git submodule update --init --recursive\n\nBats can be easily installed with `brew install bats` on OS X\n\n\n# Debugging\n\nIn order to debug the master, use the `-e DEBUG=true -p 5005:5005` when starting the container. \nJenkins will be suspended on the startup in such case,\nand then it will be possible to attach a debugger from IDE to it.\n\n# Questions?\n\nJump on irc.freenode.net and the #jenkins room. Ask!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautostructure%2Fjenkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautostructure%2Fjenkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautostructure%2Fjenkins/lists"}