jenkinsci / docker

Docker official jenkins repo
https://hub.docker.com/r/jenkins/jenkins
MIT License
6.65k stars 4.52k forks source link

SSL/TLS httpPort(s) options not working #1019

Open FF186 opened 3 years ago

FF186 commented 3 years ago

Issues and Contributing

Please note that only issues related to this Docker image will be addressed here.

If after going through the previous checklist you still think you should create an issue here please provide:

Not able to get ssl/tls on my jenkins docker container using your example nor the example from StackOverflow:

Docker commands that you execute

Dockerfile

FROM jenkins/jenkins:lts

COPY https.pem /var/lib/jenkins/cert
COPY https.key /var/lib/jenkins/pk
ENV JENKINS_OPTS --httpPort=-1 --httpsPort=8083 --httpsCertificate=/var/lib/jenkins/cert --httpsPrivateKey=/var/lib/jenkins/pk
EXPOSE 8083

other run

docker run -p 443:8443 jenkins --httpPort=-1 --httpsPort=8443 --httpsKeyStore=/var/jenkins_home/jenkins_keystore.jks --httpsKeyStorePassword=mypassword

Actual result

PORTS
 8080/tcp, 50000/tcp, 0.0.0.0:443->8083/tcp

Not able to reach on port 443 because jenkins is expecting port 8080...

Expected outcome

50000/tcp, 0.0.0.0:443->8083/tcp

Output of docker version

Docker version 19.03.8, build afacb8b

Sam-Mumm commented 3 years ago

I am facing the same problem did someone already found a solution for this problem?

DuMaM commented 2 years ago

https://github.com/jenkinsci/docker/pull/1292 Please try :)

rajeshhazari commented 1 year ago

This worked for me with my custom build jenkins docker : jenkins:rh-lts, this image does have docker client installed and mapping to jenkins uid to image uid and docker guid to image guid (I still get permission issue), ssl works when I've mounted the jks file.

my custom image jenkins:rh-lts was built from jenkins:lts

docker container run -d --restart unless-stopped -u jenkins:jenkins --network transcribe_internal -p 8777:443 -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v ${HOME}/.ssh/known_hosts:/etc/ssh/ssh_known_hosts -v /media/data-sdc3/jenkins-data/:/var/jenkins_home -v /opt/apps/:/opt/apps/:rw --env JAVA_OPTS="-Xmx2048m" --env JENKINS_OPTS="--httpPort=-1 --httpsKeyStore=/opt/apps/jenkins/ssl/devappserver-jenkins.jks --httpsKeyStorePassword=admin111 --httpsPort=443 --handlerCountMax=300 --accessLoggerClassName=winstone.accesslog.SimpleAccessLogger --simpleAccessLogger.format=combined --simpleAccessLogger.file=/var/jenkins_home/logs/access_log" --name jenkins-devappserver jenkins:rh-lts

I still get docker permission error with the below docker cmd in a job, any help here would be appreciated:

docker inspect -f . maven:3.8.7-eclipse-temurin-11

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/maven:3.8.7-eclipse-temurin-11/json": dial unix /var/run/docker.sock: connect: permission denied

allseasonsleaf commented 1 year ago

Developers have changed the parameters for the upgrade of jetty server: "Winstone 6.1: Upgrade Jetty from 9.4.46.v20220331 to 10.0.11" --> https://github.com/jenkinsci/jenkins/pull/6801 The flags --httpsPrivateKey and --httpsCertificate have been REPLACED with --httpsKeyStore and --httpsKeyStorePassword