Why can't I create a Jenkins account? - jenkins

I am new for CI servers. I successfully installed Jenkins on top of Tomcat server. At the initial security configuration, I forgot to check the box for "Allow sign up for new users". Now I can't create an account or it does not allow me to log in as I don't have an account. I tried several things to configure security, but I can't go to that page. Can someone please help me to solve this issue?

You've locked yourself out? Being able to sign-up is not going to help you when you locked yourself out, as you would still be missing permissions.
To fix this, you need access to Jenkins installation. Instructions are here:
https://wiki.jenkins-ci.org/display/JENKINS/Disable+security
Stop Jenkins (the easiest way to do this is to kill the servlet container.)
Go to $JENKINS_HOME in the file system and find config.xml file.
Open this file in the editor.
Look for the <useSecurity>true</useSecurity> element in this file.
Replace true with false
Remove the elements authorizationStrategy and securityRealm
Start Jenkins

Related

How to install Jenkins on Windows 10 Home?

How do I install jenkins on Windows 10 Home?
I am going through this link to install jenkins on local system.
https://www.jenkins.io/doc/book/installing/windows/
anytime I try to login after installation, I get following error:
From the Jenkins website I get following solution:
Logon to the computer with administrative privileges.
Open the Administrative Tools and open the Local Security Policy
Expand Local Policy and click on User Rights Assignment
In the right pane, right-click Log on as a service and select properties.
Click on the Add User or Group… button to add the new user.
In the Select Users or Groups dialogue, find the user you wish to enter and click OK
Click OK in the Log on as a service Properties to save changes.
But this is not helpful as I am trying to do this on Win 10 Home hence local security policy is not available.
I tried to check system requirements also from https://www.jenkins.io/doc/administration/requirements/windows/ but could not get definitive answer.
Are there any workarounds or solution for this?
I ran into the same problem and could not find a solution. I ended up installing docker desktop on my Win10 Home and now run the precompiled image. Works perfectly.

How to login to jenkins when LDAP server is not available?

I did setup jenkins with LDAP and i'm able to login. But when i stop the LDAP server I'm unable to login to jenkins using jenkin's local user account. Also always editing the config.xml is not a good idea to change security settings. Please help me.
What Ive done in a previous role - is a copy of Jenkins config that allows admin & a selection of other users access when LDAP is down.
When LDAP is down , I switch manually
mv config.xml config.ldap.xml
mv config.internal.xml config.xml
Restart Jenkins ( https://stackoverflow.com/a/8077830/1935094 )
The config.internal.xml was setup before I configured LDAP. You could also backup your config.xml , configure Jenkins for internal user access , copy that off and copy back in your LDAP configured config.xml.
Anyway - the idea is that you can still get in , run jobs etc until LDAP is back.
Ive had thoughts about automating it , if LDAP is detected as down ( you could run a lookup periodically , then switch if need be...
As of now, local user login is not possible when LDAP enabled. Jenkins internal user database is automatically disabled when you activate LDAP authentication.
Few Jenkins JIRA to get more details on this.
JENKINS-3404
JENKINS-29162
There is no other way except editing ~.jenkins/config.xml.
Better option is to migrate(LDAP user) to Jenkins own user database.
FOR FUTURE:
- Add a secondary LDAP server on Jenkins host.
- Remember to check "Ignore if unavailable" on the first LDAP.
More info

Jenkins Update Center broken -- java.io.IOException: Downloaded file /var/lib/jenkins/plugins/*.jpi.tmp does not match expected SHA-1 [duplicate]

I have installed Jenkins by deploying its WAR file to Tomcat. On typing
http://localhost:8080/jenkins
In browser, jenkins home page is opening which means jenkins is successfully installed. I configured system settings, gave jdk and maven path and save them. Then to install plugins, I clicked on Jenkins->Manage plugins and clicked on Available tab but could not find any plugins. I tried three solutions:
Configured proxy for Jenkins by going to Jenkins->Manage Plugins->Advanced(did not find plugins)
Restarted server, refreshed browser and went to Jenkins->Manage plugins->Available (still did not find any plugins). So, I read somewhere that we have update plugins forcefully if they are not updated automatically. So, went to Jenkins->Manage Plugins->Advanced and clicked the tab 'Check now' (Still did not find any plugins on clicking on Available tab).
Finally I read somewhere that if we add the pluginGroup 'org.jvnet.hudson.tools' to settings.xml file of maven, problem may be resolved. So, added the corresponding code to settings.xml:
Then I tried again but still could not find any plugins in
Jenkins->Manage plugins->Available
If any other solution is there which can resolve this problem please let me know.
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. When you go back to Available tab all plugins should be listed.
At the plugins section of Jenkins open the "Advanced Settings" tab and paste the following URL into the Update Server URL field (at the bottom): https://updates.jenkins.io/update-center.json
For me the following worked:
Go to Manage Jenkins->Configure Global Security
Click the checkbox for "Use browser for metadata download"
I also have security disabled and prevent cross site forgery unchecked.
You can force update the plugin list by hand.
This worked for me:
wget -O default.js http://updates.jenkins-ci.org/update-center.json
sed '1d;$d' default.js > default.json
curl -X POST -H "Accept: application/json" -d #default.json http://localhost:8080/updateCenter/byId/default/postBack --verbose
(I created this in order to be able to deploy Jenkins and install plugins in batch)
The problem may be that your browser proxy settings are not configured properly.
Jenkins doesn't retrieve the plugin list directly from the update center, it tells your browser to retrieve it and post it back to Jenkins. So the HTTP proxy settings within Jenkins are ignored for this step.
So if you are using a browser that is configured to only work within your network, to connect to local servers such as a Jenkins instance, then you won't be able to update the plugin list.
(This just happened to me and took a frustrating hour to work out.)
This was so frustrating... Not because of difficulty but lack of clarity and good documentation, at least for the issues I encountered. I ended up having to set up the Manage Plugins -> Advanced -> HTTP Proxy Configuration in a very specific, picky way. If I didn't do exactly this, minus the last noted thing on the bottom, I could not get this working. Maybe it's my work's firewall, maybe it's jenkins, either way give this a shot if you haven't been able to successfully update your proxy settings. I used the Validate Proxy tool in the menu. I'll very briefly describe the infographic basics below
Don't add http:// or https:// to your Server field
Use your jenkins credentials for Username and Password, not your proxy credentials (if that's even applicable)
Add http:// to your Test URL if you're checking something like Google or Yahoo
Submit your changes
Then run check-now
(Optional?) Change Update site from HTTP to HTTPS
You should be able to now update your plugins fingers-crossed
Change the update site from
https://updates.jenkins.io/update-center.json
to
http://updates.jenkins-ci.org/update-center.json
I had this issue when using nginx as a secure reverse proxy. I needed to update the url from which to download the updates list, as suggested above, only with https to prevent mixed content errors in chrome.
The reason why I could not find a plugin that i searched for in Jenkins->Manage plugins->Available:
It had already been installed and it was in Jenkins->Manage plugins->Installed.
I came across this SO answer while I was experiencing the same issue. When I would click "Check Now" to force Jenkins to download the latest list, my browser would just hang. It wasn't until I tailed the Jenkins log that I found this here:
Mar 10, 2014 1:15:54 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test. Returning 403.
Looks like the issue has to do with how I've put Jenkins behind a reverse proxy and enabled the option to prevent Cross Site Request Forgery. Once I disabled that, the "Check Now" completed within 30 seconds.
For me, the following works out. I experience this empty available list issue after a fresh install jenkins 1.638 on Ubuntu 1404 in virtual box. We're under an ISA proxy server.
Go to Jenkins->Manage Plugins->Advanced and setup the proxy as below:
Host: 192.168.x.x (your Proxy IP)
Port: 80 (Your proxy port)
Note that I find the format matters. I tried adding http:// it doesn't work. It has to be exactly like above.
Then hit the check now button in the bottom right as everyone else suggested. Then you get the list.
My solution is here
If you type in "http://updates.jenkins-ci.org/update-center.json" directory to brower's address bar, (in my case) it actually redirected to "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json."
It worked when I set "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json" to Jenkins' update site, and click "Save" & "Update."
Hope this helps.
Or your plugin can be already installed. Once it's installed it's not in the list of available plugins.
If you're using Chrome
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. Then click a shield icon in the address bar, click Load anyway and Jenkins will start to update plugins. In Firefox this icon is situated on the left side of address bar, near back button.
You can install plugins manually, to this this, go to advanced tab in manage plugins, after downloading plugins you need, submit these
I had an issue with NginX proxy requests to Jenkins. I had error:
Nginx 413 Request Entity Too Large
I was able to fix that by adding
client_max_body_size 2M;
to the /etc/nginx/nginx.conf file. After that I went to Jenkins - Plugin Manager - Advanced tab and press Check Now button
I had the same issue and was able to resolve it by enabling the browser metadata download. Please follow the steps below the enable this configuration in Jenkins
Step 01: Select Manage Jenkins and click on Configure Global Security
Step 02: Under the Plugin Manager section tick the "Use browser for metadata download"
Step 03: View Available tab under the Plugin Manager section in Manage Jenkins
If its a fresh installation not behind proxy please follow instruction under available "Use the search field above to search for available plugins".
After trying many things (including all the solutions posted here) and hours of searching... I've ended up with the upgrade of jenkins to version 1.638.
This helps to solve the frustrated problem with empty available plugins in older version of jenkins!
This answer is specific to Windows 10. If you use the installer that Jenkins now comes bundled as, Jenkins will get installed as a service. By default, the service runs under the Local System account. You have to change it to run under the Network Service account in order for Jenkins to be able to connect with the plugin update service. If you have Administrator privileges on the system then these steps should help:
Open Command Prompt.
Type in Services.msc and hit enter.
The Services window should be open now.
Locate the Jenkins instance in the list.
Right click on it and click Properties.
Go to the Log On tab (should be the second one).
There should be 2 radio buttons.
Local System Account (selected)
This Account (unselected)
Select This Account.
Type in Network Service in the text box.
Provide your windows password.
Hit Apply and OK.
Restart the Jenkins service.
Reload Jenkins in browser.
For added measures, you could also add a rule in Windows Firewall (or any other Firewall that you may be using) to allow outbound requests from Jenkins. Point to the jenkins.exe application that should be located in the installation directory of Jenkins for this rule.
For those like me who use Jenkins with Docker with a JDK8u60+ version, you need to remove the MD5 hash in JDK_HOME/jre/lib/security/java.security to make it works:
jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
To
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
This should be a temporary workaround
You don't have internet connection on Jenkins Machine.please configure Internet or installed plugin in offline mode.
Go to Jenkins -Plugin Manager-Upload Plugin
My Environment
Windows 7 Enterprise
Jenkins 2.89.2
Direct access to Internet
I tried most of the suggestions provided here but nothing worked until I tried following
First: I needed to run as 'Administrator'
Second: It was using default user home dir at C:\users\yourusername\.jenkins.
What Worked:
I changed default dir above to a different folder by defining JENKINS_HOME environment variable and I was able to get new plugins.
I faced the same issue with the latest Jenkins version, and all solutions didn't work with me so I followed the command line approach to install any plugin
sudo java -jar jenkins-cli.jar -s http://localhost:8080/ -auth USERNAME:PASSWORD -webSocket install-plugin PLUGIN_NAME
You can download the Jenkins-cli.jar from the installed Jenkins page http://localhost:8080/cli
You can search for the plugin name from the Jenkins site
https://plugins.jenkins.io/
If you have the Jenkins CLI installed uou can run this command
directly via terminal
jenkins-plugin-cli --plugins PLUGIN_NAME
I hope this solution helps if others didn't work with you.
I too tried all above,but this worked wonders
steps:
Go to https://plugins.jenkins.io (official page to get all jenkins plugins you are looking to install on jenkins)
Search "github" ( as we need github plugin to install)
You will see the github plugin,check the plugin id...it displays as id:github....so "github" is the exact plugin id
Download the jenkins-cli.jar from http://localhost:8080/cli and copy under /opt/jenkins-cli.jar in jenkins server
On jenkins server ,run the command to install github plugin
java -jar jenkins-cli.jar -s "http://localhost:8080" -auth jenkins-username:jenkins-password install-plugin github
Restart server
Now u will see the github plugin installed under installed section
For those who used Docker with MacOS. When you use Docker, there is no need to configure proxy settings for Jenkins inside Jenkins application, but you can and should do it already when running the container. For the context, I use MacOS and I was working within enterprise domain that had proxy configured.
SOLUTION
Configure proxy settings for Docker. You can do that if you open Preferences in Docker Desktop. The left menu, "Resources"->"Proxies". There you need to add correct proxy settings and then click "Apply & restart"
Add proxy settings to container when running it by giving and env variables HTTP_PROXY and HTTPS_PROXY. Add following flags with correct values to your command:-e HTTP_PROXY=<your_http_proxy:port> -e HTTPS_PROXY=<your_http_proxy:port>. An example with my own proxy configuration:
docker run \
-p 8080:8080 \
-p 50000:50000 \
-e HTTP_PROXY=http://10.65.100.13:8080 \
-e HTTPS_PROXY=http://10.65.100.13:8080 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts-jdk11
UNDERLYING ISSUE
The issue was SSL certificates. Jenkins, when downloading plugins, was unable to reach the CA certificates while working inside the container that was no configured to work using proxy. This caused the download to fail. Even if I configured Jenkins proxy settings as suggested in previous answers, it was no good, because the container itself failed to communicate over proxy.
Reading the Docker documentation, I found out that Docker should access CA certs itself from keychain, but it does not add proxy settings automatically to containers. Configuration to the container has to be added manually. Doing so configures the whole container properly in terms of proxy and container is able to reach for CA certs. Once the container works via proxy as expected, Jenkins does not need additional configuration itself.

How to resolve the issue in Jenkins

I am working on Jenkins by following below link and I am new to working on Jenkins.
https://blogs.msdn.microsoft.com/visualstudioalm/2016/05/27/continuous-deploymentdelivery-with-jenkins-and-vs-team-services/
Here I am facing the issue when I am installing the Jenkins its redirect to localhost URL and displaying the web page is like below figure and I am downloading the Jenkins from the below link. after redirect that its shows the Jenkins login and here I am informing before that I am not set the any logging details at any where in the Jenkins.
https://jenkins.io/
On Linux, default "admin" user password is available in /var/lib/jenkins/secrets/initialAdminPassword file.
I am not 100% sure about windows, you can check if secrets\initialAdminPassword file is available in Jenkins install directory. If yes, then try to login with credentials mentioned in this file

Unable to find plugins in list of available plugins in jenkins

I have installed Jenkins by deploying its WAR file to Tomcat. On typing
http://localhost:8080/jenkins
In browser, jenkins home page is opening which means jenkins is successfully installed. I configured system settings, gave jdk and maven path and save them. Then to install plugins, I clicked on Jenkins->Manage plugins and clicked on Available tab but could not find any plugins. I tried three solutions:
Configured proxy for Jenkins by going to Jenkins->Manage Plugins->Advanced(did not find plugins)
Restarted server, refreshed browser and went to Jenkins->Manage plugins->Available (still did not find any plugins). So, I read somewhere that we have update plugins forcefully if they are not updated automatically. So, went to Jenkins->Manage Plugins->Advanced and clicked the tab 'Check now' (Still did not find any plugins on clicking on Available tab).
Finally I read somewhere that if we add the pluginGroup 'org.jvnet.hudson.tools' to settings.xml file of maven, problem may be resolved. So, added the corresponding code to settings.xml:
Then I tried again but still could not find any plugins in
Jenkins->Manage plugins->Available
If any other solution is there which can resolve this problem please let me know.
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. When you go back to Available tab all plugins should be listed.
At the plugins section of Jenkins open the "Advanced Settings" tab and paste the following URL into the Update Server URL field (at the bottom): https://updates.jenkins.io/update-center.json
For me the following worked:
Go to Manage Jenkins->Configure Global Security
Click the checkbox for "Use browser for metadata download"
I also have security disabled and prevent cross site forgery unchecked.
You can force update the plugin list by hand.
This worked for me:
wget -O default.js http://updates.jenkins-ci.org/update-center.json
sed '1d;$d' default.js > default.json
curl -X POST -H "Accept: application/json" -d #default.json http://localhost:8080/updateCenter/byId/default/postBack --verbose
(I created this in order to be able to deploy Jenkins and install plugins in batch)
The problem may be that your browser proxy settings are not configured properly.
Jenkins doesn't retrieve the plugin list directly from the update center, it tells your browser to retrieve it and post it back to Jenkins. So the HTTP proxy settings within Jenkins are ignored for this step.
So if you are using a browser that is configured to only work within your network, to connect to local servers such as a Jenkins instance, then you won't be able to update the plugin list.
(This just happened to me and took a frustrating hour to work out.)
This was so frustrating... Not because of difficulty but lack of clarity and good documentation, at least for the issues I encountered. I ended up having to set up the Manage Plugins -> Advanced -> HTTP Proxy Configuration in a very specific, picky way. If I didn't do exactly this, minus the last noted thing on the bottom, I could not get this working. Maybe it's my work's firewall, maybe it's jenkins, either way give this a shot if you haven't been able to successfully update your proxy settings. I used the Validate Proxy tool in the menu. I'll very briefly describe the infographic basics below
Don't add http:// or https:// to your Server field
Use your jenkins credentials for Username and Password, not your proxy credentials (if that's even applicable)
Add http:// to your Test URL if you're checking something like Google or Yahoo
Submit your changes
Then run check-now
(Optional?) Change Update site from HTTP to HTTPS
You should be able to now update your plugins fingers-crossed
Change the update site from
https://updates.jenkins.io/update-center.json
to
http://updates.jenkins-ci.org/update-center.json
I had this issue when using nginx as a secure reverse proxy. I needed to update the url from which to download the updates list, as suggested above, only with https to prevent mixed content errors in chrome.
The reason why I could not find a plugin that i searched for in Jenkins->Manage plugins->Available:
It had already been installed and it was in Jenkins->Manage plugins->Installed.
I came across this SO answer while I was experiencing the same issue. When I would click "Check Now" to force Jenkins to download the latest list, my browser would just hang. It wasn't until I tailed the Jenkins log that I found this here:
Mar 10, 2014 1:15:54 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test. Returning 403.
Looks like the issue has to do with how I've put Jenkins behind a reverse proxy and enabled the option to prevent Cross Site Request Forgery. Once I disabled that, the "Check Now" completed within 30 seconds.
For me, the following works out. I experience this empty available list issue after a fresh install jenkins 1.638 on Ubuntu 1404 in virtual box. We're under an ISA proxy server.
Go to Jenkins->Manage Plugins->Advanced and setup the proxy as below:
Host: 192.168.x.x (your Proxy IP)
Port: 80 (Your proxy port)
Note that I find the format matters. I tried adding http:// it doesn't work. It has to be exactly like above.
Then hit the check now button in the bottom right as everyone else suggested. Then you get the list.
My solution is here
If you type in "http://updates.jenkins-ci.org/update-center.json" directory to brower's address bar, (in my case) it actually redirected to "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json."
It worked when I set "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json" to Jenkins' update site, and click "Save" & "Update."
Hope this helps.
Or your plugin can be already installed. Once it's installed it's not in the list of available plugins.
If you're using Chrome
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. Then click a shield icon in the address bar, click Load anyway and Jenkins will start to update plugins. In Firefox this icon is situated on the left side of address bar, near back button.
You can install plugins manually, to this this, go to advanced tab in manage plugins, after downloading plugins you need, submit these
I had an issue with NginX proxy requests to Jenkins. I had error:
Nginx 413 Request Entity Too Large
I was able to fix that by adding
client_max_body_size 2M;
to the /etc/nginx/nginx.conf file. After that I went to Jenkins - Plugin Manager - Advanced tab and press Check Now button
I had the same issue and was able to resolve it by enabling the browser metadata download. Please follow the steps below the enable this configuration in Jenkins
Step 01: Select Manage Jenkins and click on Configure Global Security
Step 02: Under the Plugin Manager section tick the "Use browser for metadata download"
Step 03: View Available tab under the Plugin Manager section in Manage Jenkins
If its a fresh installation not behind proxy please follow instruction under available "Use the search field above to search for available plugins".
After trying many things (including all the solutions posted here) and hours of searching... I've ended up with the upgrade of jenkins to version 1.638.
This helps to solve the frustrated problem with empty available plugins in older version of jenkins!
This answer is specific to Windows 10. If you use the installer that Jenkins now comes bundled as, Jenkins will get installed as a service. By default, the service runs under the Local System account. You have to change it to run under the Network Service account in order for Jenkins to be able to connect with the plugin update service. If you have Administrator privileges on the system then these steps should help:
Open Command Prompt.
Type in Services.msc and hit enter.
The Services window should be open now.
Locate the Jenkins instance in the list.
Right click on it and click Properties.
Go to the Log On tab (should be the second one).
There should be 2 radio buttons.
Local System Account (selected)
This Account (unselected)
Select This Account.
Type in Network Service in the text box.
Provide your windows password.
Hit Apply and OK.
Restart the Jenkins service.
Reload Jenkins in browser.
For added measures, you could also add a rule in Windows Firewall (or any other Firewall that you may be using) to allow outbound requests from Jenkins. Point to the jenkins.exe application that should be located in the installation directory of Jenkins for this rule.
For those like me who use Jenkins with Docker with a JDK8u60+ version, you need to remove the MD5 hash in JDK_HOME/jre/lib/security/java.security to make it works:
jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
To
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
This should be a temporary workaround
You don't have internet connection on Jenkins Machine.please configure Internet or installed plugin in offline mode.
Go to Jenkins -Plugin Manager-Upload Plugin
My Environment
Windows 7 Enterprise
Jenkins 2.89.2
Direct access to Internet
I tried most of the suggestions provided here but nothing worked until I tried following
First: I needed to run as 'Administrator'
Second: It was using default user home dir at C:\users\yourusername\.jenkins.
What Worked:
I changed default dir above to a different folder by defining JENKINS_HOME environment variable and I was able to get new plugins.
I faced the same issue with the latest Jenkins version, and all solutions didn't work with me so I followed the command line approach to install any plugin
sudo java -jar jenkins-cli.jar -s http://localhost:8080/ -auth USERNAME:PASSWORD -webSocket install-plugin PLUGIN_NAME
You can download the Jenkins-cli.jar from the installed Jenkins page http://localhost:8080/cli
You can search for the plugin name from the Jenkins site
https://plugins.jenkins.io/
If you have the Jenkins CLI installed uou can run this command
directly via terminal
jenkins-plugin-cli --plugins PLUGIN_NAME
I hope this solution helps if others didn't work with you.
I too tried all above,but this worked wonders
steps:
Go to https://plugins.jenkins.io (official page to get all jenkins plugins you are looking to install on jenkins)
Search "github" ( as we need github plugin to install)
You will see the github plugin,check the plugin id...it displays as id:github....so "github" is the exact plugin id
Download the jenkins-cli.jar from http://localhost:8080/cli and copy under /opt/jenkins-cli.jar in jenkins server
On jenkins server ,run the command to install github plugin
java -jar jenkins-cli.jar -s "http://localhost:8080" -auth jenkins-username:jenkins-password install-plugin github
Restart server
Now u will see the github plugin installed under installed section
For those who used Docker with MacOS. When you use Docker, there is no need to configure proxy settings for Jenkins inside Jenkins application, but you can and should do it already when running the container. For the context, I use MacOS and I was working within enterprise domain that had proxy configured.
SOLUTION
Configure proxy settings for Docker. You can do that if you open Preferences in Docker Desktop. The left menu, "Resources"->"Proxies". There you need to add correct proxy settings and then click "Apply & restart"
Add proxy settings to container when running it by giving and env variables HTTP_PROXY and HTTPS_PROXY. Add following flags with correct values to your command:-e HTTP_PROXY=<your_http_proxy:port> -e HTTPS_PROXY=<your_http_proxy:port>. An example with my own proxy configuration:
docker run \
-p 8080:8080 \
-p 50000:50000 \
-e HTTP_PROXY=http://10.65.100.13:8080 \
-e HTTPS_PROXY=http://10.65.100.13:8080 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts-jdk11
UNDERLYING ISSUE
The issue was SSL certificates. Jenkins, when downloading plugins, was unable to reach the CA certificates while working inside the container that was no configured to work using proxy. This caused the download to fail. Even if I configured Jenkins proxy settings as suggested in previous answers, it was no good, because the container itself failed to communicate over proxy.
Reading the Docker documentation, I found out that Docker should access CA certs itself from keychain, but it does not add proxy settings automatically to containers. Configuration to the container has to be added manually. Doing so configures the whole container properly in terms of proxy and container is able to reach for CA certs. Once the container works via proxy as expected, Jenkins does not need additional configuration itself.

Resources