Getting Jenkins to use TLS / SSL with Docker

0

1

I was looking at this wiki article: https://wiki.jenkins.io/pages/viewpage.action?pageId=135468777

it says to use these options:

--httpPort=-1  (to stop Jenkins from listening over plain HTTP)
--httpsPort=443  (or 8443 or whatever SSL port you want Jenkins to listen on)
--httpsKeyStore="%JENKINS_HOME%\jenkins.example.com.jks"
--httpsKeyStorePassword="<cleartext-password-to-keystore>"

but if I have a Dockerfile that pulls from a jenkins image like so:

FROM jenkins/jenkins:lts

then how can I add those command line arguments to the executable?

Can you do it using CMD? Or would you do it like so:

docker run --rm jenkins --httpPort=-1  etc etc

it would be nice to put the arguments in CMD or something that goes in version control.

Alexander Mills

Posted 2019-05-20T02:10:14.523

Reputation: 165

Answers

0

You can pass arguments to Jenkins by adding ENV JENKINS_OPTS to your Dockerfile. For example: ENV JENKINS_OPTS --httpPort=-1 --httpsPort=443.

Then you can put the Dockerfile to your version control.

More about this on Jenkins Docker GitHub page in section "Passing Jenkins launcher parameters".

Aulis Ronkainen

Posted 2019-05-20T02:10:14.523

Reputation: 1 283