安装docker

http://www.cnblogs.com/cjsblogs/p/8717304.html

安装jenkins

mkdir -p /root/dockerfile/base/centos/src

在我的百度网盘下载etcdGet.tar.gz:

链接:https://pan.baidu.com/s/19kKZg7QWWRq0wDg5mkhKpg 密码:7aef

将etcdGet.tar.gz上传到/root/dockerfile/base/centos/src

配置centos7.3.1611基础镜像的dockerfile

#cd /root/dockerfile/base/centos/
#vim centosdockerfile
FROM centos:7.3.1611
LABEL name="CentOS Base Image"
LABEL vendor="CentOS"
LABEL license="GPLv2"
LABEL version="7.3.1611"
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV PATH /opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV Sailor ops
ADD src/etcdGet.tar.gz /opt/bin
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& groupadd -g 2000 ${Sailor} \
&& useradd -u 2000 -g 2000 ${Sailor} \
&& mkdir -p /opt/sbin /opt/bin \
&& chown ${Sailor}:${Sailor} /opt -R \
&& mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \
&& curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
&& curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo \
&& yum update -y \
&& yum groupinstall "Development Tools" -y \
&& yum install sudo which traceroute telnet yum-utils net-tools bind-utils git curl wget vim -y \
&& yum clean all \
&& wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py \
&& python /tmp/get-pip.py \
&& git clone https://github.com/jplana/python-etcd.git /tmp/python-etcd \
&& cd /tmp/python-etcd \
&& python setup.py install \
&& chmod a+x -R /opt/bin \
&&localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

   

用centosdockerfile构建镜像:

docker build -t ip:5000/base/centos:7.3.1611 -f centosdockerfile .

docker push ip:5000/base/centos:7.3.1611

基于centos7.3基础镜像制作jdk121基础环境,:

在我的百度网盘下载jdk-8u121-linux-x64.tar.gz和security.tgz:

链接:https://pan.baidu.com/s/1hrflGRJ1Y-N17HuzkzozVg 密码:irzk
链接:https://pan.baidu.com/s/1pJV7FxtrZmg48M0k5ocVjQ 密码:exzy

  

mkdir -p /root/dockerfile/base/jdk/src

将jdk-8u121-linux-x64.tar.gz\security.tgz上传至/root/dockerfile/base/jdk/src

下面是jdkdockerfile:

#cd /root/dockerfile/base/jdk/
#vim jdkdockerfile
FROM ip:5000/base/centos:7.3.1611
ARG JAVA_VERSION=8u121
ENV JAVA_HOME /opt/jdk
ENV PATH ${JAVA_HOME}/bin:${PATH}
ADD src/jdk-${JAVA_VERSION}-linux-x64.tar.gz /tmp/
RUN mv /tmp/jdk* ${JAVA_HOME} \
&& chown ${Sailor}:${Sailor} ${JAVA_HOME} -R
ADD src/security.tgz ${JAVA_HOME}/jre/lib/security

   

用jdkdockerfile制作jdk镜像:

docker build -t ip:5000/base/jdk:8u121 -f jdkdockerfile .

docker push  ip:5000/base/jdk:8u121

用jenkinsdockerfile制作jenkins镜像:

下载如下文件:
链接:https://pan.baidu.com/s/15rtCjghIH7Wwx7H7PHboqQ 密码:ju3a

  

  

下面是jenkinsdockerfile:

#cd /root/dockerfile/service/jenkins/
#vim jenkinsdockerfile
FROM 172.16.5.113:5000/base/jdk:8u121
ENV APP_LABEL jenkins
ENV JENKINS_HOME /home/${Sailor}/${APP_LABEL}
ENV JENKINS_SLAVE_AGENT_PORT 50000
RUN mkdir -p ${JENKINS_HOME}
VOLUME ${JENKINS_HOME} USER root
RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d ENV TINI_VERSION 0.14.0
ENV TINI_SHA 6c41ec7d33e857d4779f14d9c74924cab0c7973485d2972419a3b7c7620ff5fd
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \
&& echo "$TINI_SHA /bin/tini" | sha256sum -c - COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.99}
ARG JENKINS_SHA=7c783d758b150f6b4ab14aaf1a745b888fff10eea46f1b1cfc0e2730f3dde918
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war \
&& echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c - ENV JENKINS_UC https://updates.jenkins.io
ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
RUN chown -R ${Sailor} "$JENKINS_HOME" /usr/share/jenkins/ref
EXPOSE 8080
EXPOSE 50000
ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
USER ${Sailor} COPY jenkins-support /usr/local/bin/jenkins-support
COPY jenkins.sh /usr/local/bin/jenkins.sh
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] COPY plugins.sh /usr/local/bin/plugins.sh
COPY install-plugins.sh /usr/local/bin/install-plugins.sh

  

  

  

用jenkinsdockerfile制作jenkins镜像;

docker build -t ip:5000/services/jenkins:v2.99 -f jenkinsdockerfile .

 docker push  ip:5000/base/jenkins:v2.99

授权;

groupadd -g 2000 ops
useradd -u 2000 -g 2000 ops
chown -R ops:ops /opt/jenkins_master/

  

jenkins镜像启动:

docker run -d -p 8080:8080 -p 50000:50000 --restart=always --name CJS_JENKINS -v /opt/jenkins_master:/home/ops/JENKINS_HOME ip:5000/service/jenkins:v2.99

 

查看初始密码:

docker logs ­f 0d0866f3e259 

添加从节点:

宿主机安装jdk,并复制jdk环境变量做如下操作

登录jenkins-系统管理-管理节点-新建节点

此处选择hosts key选项请注意

如果用秘钥,复制master的私钥

plugins.txt:

ace-editor
active-directory
analysis-collector
analysis-core
antisamy-markup-formatter
ant
apache-httpcomponents-client-4-api
authentication-tokens
azure-commons
bitbucket
blueocean-autofavorite
blueocean-bitbucket-pipeline
blueocean-commons
blueocean-config
blueocean-dashboard
blueocean-display-url
blueocean-events
blueocean-github-pipeline
blueocean-git-pipeline
blueocean-i18n
blueocean-jira
blueocean
blueocean-jwt
blueocean-personalization
blueocean-pipeline-api-impl
blueocean-pipeline-editor
blueocean-pipeline-scm-api
blueocean-rest-impl
blueocean-rest
blueocean-web
bouncycastle-api
branch-api
build-name-setter
build-pipeline-plugin
build-timeout
built-on-column
checkstyle
clearcase
cloudbees-bitbucket-branch-source
cloudbees-folder
cobertura
conditional-buildstep
config-file-provider
copyartifact
credentials-binding
credentials
cvs
dashboard-view
display-url-api
docker-commons
docker-slaves
docker-workflow
durable-task
email-ext
emailext-template
embeddable-build-status
envinject-api
envinject
extended-choice-parameter
extensible-choice-parameter
external-monitor-job
favorite
findbugs
git-client
github-api
github-branch-source
github
github-organization-folder
git
git-parameter
git-server
gradle
groovy
handlebars
htmlpublisher
icon-shim
jackson2-api
javadoc
jenkins-multijob-plugin
jira
jquery-detached
jquery
jsch
junit
kubernetes-cd
kubernetes
kubernetes-pipeline-aggregator
kubernetes-pipeline-arquillian-steps
kubernetes-pipeline-devops-steps
kubernetes-pipeline-steps
ldap
mailer
mapdb-api
matrix-auth
matrix-project
maven-plugin
mercurial
metrics
momentjs
msbuild
nodejs
ownership
p4
pam-auth
parameterized-trigger
pipeline-build-step
pipeline-github-lib
pipeline-githubnotify-step
pipeline-graph-analysis
pipeline-input-step
pipeline-maven
pipeline-milestone-step
pipeline-model-api
pipeline-model-declarative-agent
pipeline-model-definition
pipeline-model-extensions
pipeline-multibranch-defaults
pipeline-rest-api
pipeline-stage-step
pipeline-stage-tags-metadata
pipeline-stage-view
pipeline-utility-steps
plain-credentials
pmd
publish-over-ssh
pubsub-light
python
rebuild
repo
report-info
resource-disposer
role-strategy
run-condition
scm-api
script-security
sse-gateway
ssh-agent
ssh-credentials
ssh
ssh-slaves
structs
subversion
teamconcert
tfs
throttle-concurrents
timestamper
token-macro
variant
warnings
windows-slaves
workflow-aggregator
workflow-api
workflow-basic-steps
workflow-cps-global-lib
workflow-cps
workflow-durable-task-step
workflow-job
workflow-multibranch
workflow-scm-step
workflow-step-api
workflow-support
ws-cleanup
xunit

上传到:/opt/jenkins_master/plugins

进入容器:

跑脚本:

/usr/local/bin/plugins.sh /opt/jenkins_master/plugins.txt

 

jenkins-docker部署的更多相关文章

  1. Jenkins+Docker部署Maven聚合工程

    这几天,把公司的预发布环境,改成docker部署,遇到了一些坑,有jenkins里的部署脚本的问题,也有harbor仓库的问题,还有docker远程访问的问题,还有DooD....一堆坑 Jenkin ...

  2. jenkins+docker部署java项目

    jenkins + maven + jdk + docker + docker register + dockerfile jenkins插件 # 安装插件 SSH # 配置 系统设置-> SS ...

  3. node项目自动化部署--基于Jenkins,Docker,Github(1)安装Jenkins

    前言 每次项目代码更新后都要重新部署,如果只有一台服务器还好. 但是如果是分布式系统,动不动就很多台服务器,所以代码的自动部署就显得十分重要了. 这里用几篇文章来记录一下如何使用Jenkins,Doc ...

  4. 通过Jenkins + Docker实现antdPro自动化推送私服、自动容器化部署功能

    Docker与Docker私服 1. 安装docker https://docs.docker.com/install/ 2. 配置docker镜像加速 https://www.daocloud.io ...

  5. docker部署Jenkins,以及在Jenkins中使用宿主机的docker/docker-compose命令

    使用最新的官方镜像jenkins/jenkins 第一次使用的docker部署jenkins的时候,出现了两个问题: 1.因为用户权限问题挂载/home/jenkins/data到/var/jenki ...

  6. .Net core 使用Jenkins + Docker + Azure Devops 傻瓜式部署

    这几天一直在搞 Jenkins + Docker + Azure Devops 部署,因为这种方式部署真的非常的省心,而且速度快,方便快捷,等等无数优点,感谢我的单身领导的支持,当然也感谢 晓晨大神, ...

  7. jenkins+Docker持续化部署(笔记)

    参考资料:https://www.cnblogs.com/leolztang/p/6934694.html (Jenkins(Docker容器内)使用宿主机的docker命令) https://con ...

  8. AspNetCore容器化(Docker)部署(四) —— Jenkins自动化部署

    一.前言 (Jenkins.Docker.Git/Svn组建一套简单的自动化发布流程) 文章中用到的相关服务器角色 角色 环境 功能 开发机 Win10.Docker(Linux OS) 编码.调试 ...

  9. kubernetes部署jenkins(Docker in Docker)及认证

    引言 Jenkins是一款开源 CI&CD 软件,用于自动化各种任务,包括构建.测试和部署软件. 本文将Jenkins的master与slave置于Pod中,部署在namespace:jenk ...

  10. docker安装jenkins自动化部署

    Docker之Jenkins自动化部署 1.拉取jenkins镜像images(类比:java中的类) docker pull jenkinsci/jenkins:lts 或 docker pull ...

随机推荐

  1. python3 输入与输出

    pyhon3 io 输入和输出myread=open('E:/路径.txt')#open()会将返回一个file对象mywrite=open('E:/3/路径.txt','w')#后面w是如果文件存在 ...

  2. hadoop yarn日志分离

    根据hdfs的auditlog以及fsimage分析,yarn的日志文件占用了10%-20%的rpc请求以及文件量,这对namenode的性能有比较大的影响,特别是当集群规模越来越大,会影响生产业务. ...

  3. 7.1 Spring原理

    7.1 Spring原理 一.spring是什么?(IOC.AOP.MVC) Spring是一个基于IOC和AOP的结构J2EE系统的框架 , 1.1 IOC 控制反转 是Spring的基础,Inve ...

  4. 2.微服务开发框架——Spring Cloud

                     微服务开发框架—Spring Cloud 2.1. Spring Cloud简介及其特点 简介: Spring Cloud为开发人员提供了快速构建分布式系统中一些常见 ...

  5. koa 基础(二十)nodejs 操作mongodb数据库 --- 新增数据

    1.app.js /** * nodejs 操作mongodb数据库 * 1.安装 操作mongodb * cnpm install mongodb --save * 2.引入 mongodb 下面的 ...

  6. LC 539. Minimum Time Difference

    Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minut ...

  7. springboot和springcloud版本冲突问题

    最近搭建eureka项目,出现boot和cloud版本不匹配错误,记录下来 2019-12-06 14:00:20.043 ERROR 180780 --- [ main] o.s.boot.Spri ...

  8. CentOS 安装jdk 1.8

    方法一:手动解压JDK的压缩包,然后设置环境变量   1.在/usr/目录下创建java目录  [root@localhost ~]# mkdir/usr/java [root@localhost ~ ...

  9. Tensorflow 多层全连接神经网络

    本节涉及: 身份证问题 单层网络的模型 多层全连接神经网络 激活函数 tanh 身份证问题新模型的代码实现 模型的优化 一.身份证问题 身份证号码是18位的数字[此处暂不考虑字母的情况],身份证倒数第 ...

  10. 【Python基础】lpthw - Exercise 47 自动化测试

    一.自动化测试的目的 利用自动化的测试代码取代手动测试,使得程序中的一些初级bug可以被自动检出,而无需人工进行重复繁琐的测试工作. 二.编写测试用例 利用上一节编写的skeleton,这次在proj ...