内容纲要
部署
Dockerfile
FROM jenkins/jenkins:lts
MAINTAINER Lockey
USER root
ARG dockerGid=999
RUN echo "docker:x:${dockerGid}:jenkins" >> /etc/group
构建
docker build . -t myjenkins
运行
docker run -d --privileged=true -p 8005:8080 -p 50000:50000 --name myjenkins_1 -v /root/jenkins:/var/jenkins_home -v /root/.ssh:/var/jenkins_home/.ssh -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -v $(which docker):/usr/bin/docker -v $(which docker-compose):/usr/bin/docker-compose myjenkins
Slave
- 安装Java(8)
- apt install openjdk-8-jre-headless
- 配置免密登录
- ssh-keygen -t rsa
注意
- .ssh文件挂载
- Git访问
- Slave访问
- Dockerfile
- 将用户加入docker用户组,不然没有Docker访问权限
更换源【国内】
打开: http[s]://[URL]/pluginManager/advanced
替换升级站点URL:http://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
PS:如果出现更换后还是走了官方源,可以配置 Nginx:
rewrite ^/download/plugins/(.*)$ http://mirrors.tuna.tsinghua.edu.cn/jenkins/plugins/$1? last;