In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to achieve docker-compose installation Jenkins". In daily operation, I believe many people have doubts about how to achieve docker-compose installation Jenkins. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to achieve docker-compose installation Jenkins"! Next, please follow the editor to study!
Create a directory
Cd / usr/local/docker/mkdir jenkins-dockercd jenkins-docker
Create Dockerfile
The following is the contents of the file FROM jenkins/jenkins:ltsUSER rootRUN mkdir-p / usr/local/ & &\ cd / usr/local/ & &\ curl-fsSL https://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz > / usr/local/apache-maven-3.6.3-bin.tar.gz & & \ tar xzf / usr/local/apache-maven-3.6.3-bin.tar.gz-C / usr/local/ & &\ rm-rf / usr/local/apache-maven-3.6.3-bin.tar.gz & &\ ln-s / usr/local/apache-maven-3.6.3/bin/mvn / bin/mvn & &\ ln-s / usr/local/apache-maven-3 .6.3 / bin/mvnyjp / bin/mvnyjp & &\ export PATH=/usr/local/apache-maven-3.6.3/bin:$PATHUSER jenkins
Build an image
Docker build-t jenkins-jiacs:lts.
Check the Group ID of Docker on the host
Cat / etc/group | grep docker# [root@localhost jenkins-docker] # cat / etc/group | grep docker# docker:x:994:# here is 994, depending on their actual values
Start the Jenkins container (docker command line startup)
# create a / usr/local/docker/jenkins-docker/data folder and grant permissions before starting the container # / usr/local/docker/jenkins-docker/config/settings.xml this file is provided by itself (customizable private server and other information) mkdir datachmod-R 777 datadocker run-d-p 80808080-p 50000mkdir datachmod 50000\-v / usr/local/docker/jenkins-docker/data:/var/jenkins_home\-v / etc/localtime : / etc/localtime:ro\-v / var/run/docker.sock:/var/run/docker.sock\-v / etc/docker:/etc/docker\-v / usr/bin/docker:/usr/bin/docker\-v / usr/local/bin/docker-compose:/usr/local/bin/docker-compose\-v / usr/local/docker/jenkins-docker/config/settings.xml:/usr/local/apache-maven-3. 6.3/conf/settings.xml\-- group-add=994\-- name my-jenkins\ jenkins-jiacs:lts# description: # 1.-v / usr/local/docker/jenkins-docker/data:/var/jenkins_home = "persistent Jenkins data # 2.-v / etc/localtime:/etc/localtime:ro =" setting the Jenkins container time is the same as the host # 3.-v / etc/docker:/etc/docker = "the docker used in the Jenkins container is the docker installed for the host Ensure that the service deployed by Jenkins is started in the host # 4.-v / usr/local/bin/docker-compose:/usr/local/bin/docker-compose if the host has docker-compose installed If you need to use the Jenkins container, you can add the data volume #-v / usr/local/docker/jenkins-docker/config/settings.xml:/usr/local/apache-maven-3.6.3/conf/settings.xml#-- group-add=994 to set the launched container user group to the user group of docker in the host, and ensure that you have permission to operate the host's docker command in the Jenkins container.
Start the Jenkins container (docker-compose startup)
Cd / usr/local/docker/jenkins-dockervi jenkins-docker.yamlversion: do not change the version number of'2' # Some versions do not support the group_add parameter services: jenkins: image: 'jenkins-jiacs:lts' container_name: my-jenkins # restart: always ports: -' 8080 data:/var/jenkins_home # restart: always ports:-'8080 etc/localtime:/etc/localtime:ro 8080'-'50000 etc/localtime:/etc/localtime:ro 5000' volumes: -. / data:/var/jenkins_home-/ etc/localtime:/etc/localtime:ro-/ var/ Run/docker.sock:/var/run/docker.sock-/ etc/docker:/etc/docker-/ usr/bin/docker:/usr/bin/docker-/ usr/local/bin/docker-compose:/usr/local/bin/docker-compose -. / config/settings.xml:/usr/local/apache-maven-3.6.3/conf/settings.xml
Start
Docker-compose-f jenkins-docker.yaml up-d
View the container
Docker ps
Enter the container
Docker exec-it 0d8b70ba5cec bash# View Jenkins initial password (executed in Container) cat / var/jenkins_home/secrets/initialAdminPassword
Open a browser to access the Jenkins service
Http://:8080/
Fill in the initial password you just found
Select to install the recommended plug-ins and wait for the plug-ins to be installed (it will take a little longer here). If some plug-ins fail, you can click retry to continue the installation, or record the failed plug-ins. Install manually in the system configuration-plug-in configuration
Modify Jenkins time zone
System management > script command line, enter the command, and click [run]
System.setProperty ('org.apache.commons.jelly.tags.fmt.timeZone',' Asia/Shanghai')
Installation completed
At this point, the study on "how to implement docker-compose installation Jenkins" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.