docker-compose install jenkins

2022-11-14 Update the jenkins version to 2.377-jdk11. The following problems will be solved. If there is a problem, just follow the following steps to solve it.

Problems encountered
1. Stuck in the initialization interface [the reason is that the path in hudson.model.UpdateCenter.xml is not configured]
2. Failed to download plugins [ Reason 1 : Update Site needs to be configured (upgrade site)]
3. Failed to download plugins [ reason] Second , the Jenkins version is too low]

Keywords of this article [gradle] [docker-compose] [jekins download plug-in failed] [jekins stuck in the initialization interface] [jekins
configuration] [jekins installation] [docker-compose installation jekins]

1.docker-compose.yaml

The jdk11 here means that the running environment of jekins is jdk11, which has little to do with the version of jdk we use to compile the project using jekins.

version: '3.3'
services:
  docker_jekins:
    image: jenkins/jenkins:2.377-jdk11
    container_name: docker_jekins
    volumes:
      - ./data/jenkins/:/var/jenkins_home
      - ./var/run/docker.sock:/var/run/docker.sock
      - ./usr/bin/docker:/usr/bin/docker
      - ./usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7
    user: root
    ports:
      - "8081:8080"
    expose:
      - "50000"
      - "8080"
    privileged: true
    restart: unless-stopped
    environment:
      JAVA_OPTS: '-Djava.util.logging.config.file=/var/jenkins_home/log.properties'

2. After docker-compose is started for the first time, it will be stuck on the login interface. At this time, we need to modify the configuration.

找到文件
hudson.model.UpdateCenter.xml
把路径
http://updates.jenkins-io/update-center.json
修改成
http://mirror.xmission.com/jenkins/updates/update-center.json

Then execute the following 2 commands to close the container and start the container

docker-compose down 
docker-compose up -d

3. When you start it again, you will enter the password input interface.

Our local Linux password is in /data/jekins/secrets/initialAdminPassword
Insert image description here

4. Solution to plug-in download failure

Insert image description here
The reason why we can't download the plug-in is because of the domestic network problem. We can change the configuration later after we log in.

4.1 Click Continue to enter the Jenkins interface and configure the plug-in download path

4.2 Here we click to correct

Insert image description here

Click Manage Jenkins—>Correct—>Advanced—>find Update Site and replace it with

http://mirror.xmission.com/jenkins/updates/update-center.json

submit
Insert image description here

4.2 Re-download the plug-in, Available–>Search plug-in–>install

Insert image description here

4.3 After completing the plug-in installation, restart Jenkins

docker-compose down
docker-compose up -d

4.5 I can successfully use the maven project here, but not gradle.

In the global configuration, I can't find the gradle plug-in here.
Insert image description here

I went to the plug-in management place and looked at some plug-ins and they were still reporting errors, so I downloaded all the plug-ins. It turned out that it prompted me that the Jenkins version was too low, so I changed the version in docker-compose.ymal to jenkins. /jenkins:2.359-jdk11. I repeated the above steps several times before installing Jenkins successfully.
Insert image description here

5. Tips

Please follow the above steps one at a time to follow Jenkins. If there is an error, carefully look at the keyword position in the article.

6.Extended links

docker download image is too slow

Guess you like

Origin blog.csdn.net/weixin_42581660/article/details/126142898