Install Jenkins with Docker and solve the problem of initial plugin installation failure

Install Jenkins with Docker and solve the problem of initial plugin installation failure

After installing Jenkins, the initial download of the plugin always fails, resulting in unsuccessful installation. After retrying several times, it is still stuck at installing the plugin.

Here is a record of how to install Jenkins under Docker and solve the problem of initial plugin installation failure.

The failure to install the plug-in actually means that the official Jenkins image is pulled, and then when the plug-in is initially installed, it is obtained from a foreign website, resulting in a very slow installation or even a failed installation. The best solution is to pull the Jenkins image provided by the Jenkins Chinese community. Jenkins Chinese official website: https://www.jenkins.io/zh/

Installation steps Get the image

docker pull jenkinszh/jenkins-zh:latest

Docker official image repository: https://hub.docker.com/

Find the Jenkins Chinese mirror here

Set the jenkins container mount directory

After the Jenkins container is started, installation configuration files will be generated. You need to change the generation address of these files to the directory on the Linux server.

Purpose: To make it easier to find the configuration when it is modified in the future.

Create a Jenkins build directory mkdir /home/jenkins_home

Directory authorization chmod 777/home/jenkins_home If the system is not authorized, files cannot be generated after startup.

Startup Command

docker run -d -p 8085:8080 -p 50000:50000 --name myjenkins -v /home/jenkins_home/:/var/jenkins_home jenkinszh/jenkins-zh:latest

Command Explanation:

Run the container
-d Run in the background
-p Linux server port and Docker container port mapping
--name Custom container alias
-v The last name of the Linux server directory and the Docker container directory is followed by the image name and version pulled when mounting

Note: 8085 is the access port, and any port that is not occupied can be used. 8080 cannot be changed

-p 50000:50000 cannot be changed.

/home/jenkins_home/ The local build directory can be customized and is consistent with the directory created and authorized in the previous step

/var/jenkins_homeDocker container directory, cannot be changed.

access

Server IP + custom port example: 192.168.0.200:8085

Initial password

docker ps Get the id of the currently running container

Docker logs container ID

You can see it in the logs log, similar to this

Plugin Installation

The Jenkins image provided by the Chinese community does not require any settings, it can be installed directly, and the speed is very fast.

Appendix - Analysis of failure to install plugins on official images

Take the directory mounted by Jenkins above as an example

In the jenkins_home directory, the hudson.model.UpdateCenter.xml file defines the configuration address for the plugin to pull. The default address can be accessed directly. You will find that it connects to https://www.google.com/. Due to the firewall, this address has always failed to be accessed.

The content of the default.json file in the /jenkins_home/updates directory is the content of the configuration address pulled by the plug-in defined in hudson.model.UpdateCenter.xml. Even if you modify the default.json file content through other blogs, it will be restored immediately when you start it again, so no matter how you modify it, it will not take effect .

The mirror provided by the Jenkins Chinese community has been processed, and the configuration address for plug-in pulling has been changed to the domestic mirror address, so the plug-in download is very fast.

Jenkins Chinese community's explanation on plugin pulling:

https://community.jenkins-zh.cn/t/jenkins/26

https://jenkins-zh.cn/wechat/articles/2019/11/2019-11-11-update-center-mirror-announcement/

Suggest to learn more

This is the end of this article about installing Jenkins with Docker and solving the problem of initial plugin installation failure. For more relevant content about installing Jenkins with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker installation of Jenkins full process and stepping on the guide
  • Getting Started Tutorial on Jenkins Installation and Plugin Management Configuration
  • Jenkins environment setup download and installation process
  • Linux installation steps for Jenkins and various problem solving (page access initialization password)
  • How to install Jenkins on CentOS 8
  • Detailed instructions for installing Jenkins on Ubuntu 16.04
  • Analysis and solution of time zone problem in Jenkins installation

<<:  JS uses map to integrate double arrays

>>:  Tutorial on installing MySQL 8.0.11 under Linux

Recommend

Docker's flexible implementation of building a PHP environment

Use Docker to build a flexible online PHP environ...

How to optimize MySQL indexes

1. How MySQL uses indexes Indexes are used to qui...

How to solve the problem that mysql cannot be closed

Solution to mysql not closing: Right-click on the...

Example code for hiding element scrollbars using CSS

How can I hide the scrollbars while still being a...

Example of using nested html pages (frameset usage)

Copy code The code is as follows: <!DOCTYPE ht...

Three Ways to Find the Longest Word in a String in JavaScript (Recommended)

This article is based on the Free Code Camp Basic...

Detailed explanation of the process of building and running Docker containers

Simply pull the image, create a container and run...

The concept and characteristics of MySQL custom variables

A MySQL custom value is a temporary container for...

Complete steps of centos cloning linux virtual machine sharing

Preface When a Linux is fully set up, you can use...

A brief discussion on the fun of :focus-within in CSS

I believe some people have seen this picture of c...

CSS3 speeds up and delays transitions

1. Use the speed control function to control the ...

Several common methods for setting anchor positioning in HTML

There are several ways I know of to set anchor pos...

Native js to achieve simple carousel effect

This article shares the specific code of js to ac...

MySQL paging query optimization techniques

In applications with paging queries, queries that...