当前位置:网站首页>Set up Jenkins environment and automatically associate packaged project jars for automatic release
Set up Jenkins environment and automatically associate packaged project jars for automatic release
2022-06-29 08:14:00 【Muyiyang who likes fire shadow】
This article focuses on how to use Docker Building a jenkins Environmental Science , And how to use this jenkins Build automatically 、 Automatic release and other pipeline operations .
One .Docker Build... In the environment jenkins
We open the front hair Docker Environment interface , The overall procedure is : Pull jenkins Mirror image --> Set the image mount directory and authorization --> Mount directory mapping 、 Turn on port mapping 、docker function jenkins Mirror image --> see jenkins Image operation --> see jenkins Run log -->windows Virtual machine configuration port mapping --> Browser access jenkins Console .
(1) Pull jenkins Mirror image :
stay docker in , It mainly loads images one by one ( It can be understood as a service out of the box file ) Run , Before running these images , You need to pull these images from the image warehouse first , The running image is displayed in docker The container exists independently , Different docker Containers do not interfere with each other .
docker pull jenkins/jenkins
You can see docker It will automatically pull the latest version for us jenkins Mirror image , Of course, you can set the pull version by yourself

docker images
View the pulled image

The next step is to set jenkins The mount directory for , We use /usr/local/jenkins Directory as Mount Directory , And set permissions
mkdir -p /usr/local/jenkins
chmod 777 /usr/local/jenkins
The next step is to mount the directory mapping 、 Turn on port mapping 、docker function jenkins Mirror image
docker run -d -p 8080:8080 -v /usr/local/jenkins:/var/jenkins_home -v /etc/localtime:/etc/localtime --restart=always -u root --name my_jenkins jenkins/jenkins
The above command is used directly docker Run the jenkins The mirror , Need to focus on :
(1)-p 8080:8080, It is important to note that jenkins Internal default use 8080 Port to start , That is to say, we need to enable the host and by default docker In container 8080 Mapping between ports , Let the host and this docker Container of 8080 Ports can access each other .
(2)-v /usr/local/jenkins:/var/jenkins_home, What needs to be noticed is this docker Inside the container jenkins An image is actually a file system , We can use the command to enter docker Inside the mirror
docker ps -a
docker exec -it <Container ID> /bin/bash
It can be found that we can pass cd Get to this jenkins Of /var/jenkins_home In the catalog , That is to say, each docker Inside the container is an independent linux environmental system , After entering, you can go through exit sign out docker Inside of container .

therefore , above -v /usr/local/jenkins:/var/jenkins_home Will be docker Mount directory of the external host , And docker The actual inside of the container jenkins Directory to mount and bind , So that we can directly reference to... By accessing the mount directory of the host docker Inside the container jenkins.
(3)-u root --name my_jenkins jenkins/jenkins, We need to use the administrator account root To operate , Then reprint this to docker Take a name for the internal image my_jenkins It is convenient to distinguish multiple identical published images .
Run the command completely through the above , You can go to docker Run a... In the container jenkins Mirror instance .
docker ps -al

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3342f36002f3 jenkins/jenkins "/usr/bin/tini -- /us" 21 hours ag Up 22 hours 0.0.0.0:8080->8080/tcp, 50000/tcp my_jenkins
You can see jenkins Instance started , Port binding is also performed .
docker logs my_jenkins
View the running log of the image , We can see the operation , At the same time, remember that there will be a password after successful operation ( Red box ), This password is used to log in for the first time jenkins The password for the console .


however , We visit... In a computer browser localhost:8080 But you will find that you can't open jenkins Console , That's because although Docker Environmental Science --Docker The internal port mapping has been associated , But our computer mainframe VirtualBox and Docker The port mapping of the environment is not open , That is to say, you can use a computer browser to access 8080 In fact, you can't reach the virtual machine 8080 Of , So we need to be in VirtualBox Port configuration in ( Of course for linux Physical machines do not need this layer of operation ).
open VirtualBox-- Set up -- grid -- The connection mode can be NAT-- senior -- Port forwarding --
With the specified port mapping


In this way, you can access... Through the browser localhost:8080 open jenkins Console. , The first time I landed , Password in

Output the password marked in the red box in the above startup log , You can log in , Install the wait using the recommended configuration , Then create a new user .


The following can be found in jenkins Create a publishing pipeline on .
边栏推荐
- Process communication - Pipeline
- 华为云的AI深潜之旅
- Automated test - uiautomator2 framework application - automatic clock in
- C compiler - implicit function declaration
- 阿里的211是指什么?
- Use GPU training in the cloud on the laboratory (take yolov5 as an example)
- AC自动机
- C#Mqtt订阅消息
- SQL SERVER 2008 发布订阅到SQL Server 2017避坑指南
- Basic syntax - bit operation
猜你喜欢

穿越过后,她说多元宇宙真的存在

1284_ Implementation analysis of FreeRTOS task priority acquisition

A review of visual SLAM methods for autonomous driving vehicles

SizeBalanceTree

低配MySQL数据库几十秒插入百万数据

关于组织2021-2022全国青少年电子信息 智能创新大赛西北赛区(陕西)复赛的通知

Behaviortree in ros2

自注意力机制超级详解(Self-attention)

Common MySQL errors and solutions summarized painstakingly (II)

Binary search tree
随机推荐
笔记本电脑快速连接手机热点的方法
特征选择:最大信息系数(MIC;Maximal Information Coefficient)【用于衡量两个变量X和Y之间的关联程度,线性或非线性的强度,常用于机器学习的特征选择】
Blueprint basis
自注意力机制超级详解(Self-attention)
在colaboratory上云端使用GPU训练(以YOLOv5举例)
solidity部署和验证代理合约
MySQL enable logging
jsp学习部分
《动手学深度学习》(一)-- 线性神经网络
MySQL statistics by day / week / month / quarter / half year / year
Should product managers learn from ink knife or Axure?
VSLAM特征之线特征&面特征
MySQL系统关键字汇总(官网)
MongoDB-使用mongo/mongosh命令行连接数据库
Ceres optimization based on sophus
SQL SERVER 2008 发布订阅到SQL Server 2017避坑指南
Flutter 文件读写-path_provider
SQL Server 2008 publish and subscribe to SQL Server 2017 pit avoidance Guide
一个高频问题,三种模型思维来破解此风控难题
In PHP version 7.1.13, it is found that floating-point data passes through JSON during use_ There will be precision problems after encode