1、jenkins docker部署
1.1、安装 Docker
yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce
1.2、配置官方国内镜像仓库与添加私有仓库可信任
cat > /etc/docker/daemon.json << EOF { "registry-mirrors": ["https://registry.docker-cn.com"] } EOF systemctl restart docker
1.3、构建jenkins
cat > Dockerfile << EOF FROM jenkins USER root RUN echo '' > /etc/apt/sources.list.d/jessie-backports.list && wget http://mirrors.163.com/.help/sources.list.jessie -O /etc/apt/sources.list RUN apt-get update && apt-get install -y git libltdl-dev EOF
docker build -t jenkins:v1 .
docker run -d
--name jenkins
-p 8888:8080
-v /var/jenkins_home/:/var/jenkins_home
-v /usr/local/apache-maven-3.5.0:/usr/local/maven
-v /usr/local/jdk1.8.0_45:/usr/local/jdk
-v /var/run/docker.sock:/var/run/docker.sock
-v $(which docker):/usr/bin/docker
-v ~/.ssh:/root/.ssh
jenkins:v1
1.4、浏览器访问http://192.168.100.21:8888(图片借鉴)
根据提示,获取出事密码,继续
安装插件,默认安装,或者自定义
安装完成后,创建用户,即完成部署
2、jenkins客户端 部署(页面)
2.1、系统管理 --> 管理节点 --> 新建节点
配置节点
启动方式,选择高级,定义jdk
选择重启代理,等待安装即可,跟踪页面日志