Unable to download plugin in Jenkins set up on docker container

Viewed 105

I have setup Jenkins in docker container in my laptop. But after installation, unable to plugin any of the plugins. Below is the error. Docker image of jenkins used is jenkins/jenkins:2.289.1-lts-jdk11.

The docker linux containers are setup in windows 10 laptop. I have already done some workarounds like updating the path to http://updates.jenkins.io/update-center.json instead of https and placing the skip-certificate-check.hpi in the plugins path.

But those are not helping in the below error.

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
    at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
    at java.base/sun.security.validator.Validator.validate(Validator.java:264)
    at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:222)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
    at 
1 Answers

Add server's root cert in your trusted keystore.
Note: storepass is usually "changeit"

sudo keytool -importcert -keystore <keystore-path>/cacerts -storepass <password> -file <server's root .crt file path> -alias "jenkins-updates"

Restart & check.

If the server root cert is not available handy then load it in a file "root.crt" using below:
(There is also a manual way to get the server's certificate, not going through it here.)

  • Paste the URL "https://updates.jenkins.io/update-center.json" in website https://www.ssllabs.com/ssltest/analyze.html & download the server's certificate & save it as root.crt
  • Use this file path in the above importcert command.
Related