Pre-configured Environment Variable in Jenkins

2019-09-20 15:37发布

问题:

I am running Jenkins though the docker image.

I want my Jenkins Installation to come up with few pre configured enviroment variables.

Is there any way I can copy some of my environment variables, so that when I bring my jenkins up, it should come with these pre-configured environment variables ?

TIA.

回答1:

A list of available environment variables is available here: https://hub.docker.com/_/jenkins/

Update

If you want to add your own environment variables you need to build your own jenkins image. You can do this by extending an existing image or modify the official docker build project provided by jenkins on GitHub.

Docker has a nice tutorial on how to build images here.

In this specific case you need to modify the docker entrypoint file to retrieve and replace the environment variables where needed. For jenkins, the docker entrypoint file is located in /usr/local/bin/jenkins.sh.