docker 部署jenkins
#查看jenkins镜像
docker search jenkins
#安装jenkins
docker pull jenkins/jenkins:lts
#jenkins 挂载目录
mkdir -p /home/jenkins/workspace
#修改maven 仓库镜像地址(替换为国内的镜像地址) /usr/local/maven/apache-maven-3.9.9/conf/settings.xml
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
#将jdk maven 传入docker容器实例里面
docker cp /usr/local/java/jdk1.8.0_181/. jenkins:/usr/local/jdk8
docker cp /usr/local/maven/apache-maven-3.9.9/. jenkins:/usr/local/maven/apache-maven-3.9.9
#jenkins ci/cd 插件
#Maven Integration
#Publish Over SSH
#Git
#启动jenkins
docker run -uroot -d --restart=always -p 9001:8080 \
-v /home/jenkins/workspace/:/var/jenkins_home/workspace \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/local/maven/apache-maven-3.8.8:/usr/local/maven \
--name jenkins jenkins/jenkins:lts
#-uroot 是以管理员身份登入容器查看密码
docker exec -it -uroot jenkins bash
jenkins 全局工具配置
创建maven项目(CI/CD)
参考链接:
https://blog.csdn.net/qq_51726114/article/details/134174736
https://blog.csdn.net/dontYouWorry/article/details/129007966
https://blog.csdn.net/qq_36858491/article/details/136525564