Jenkins中文官网:https://jenkins.io/zh/
jenkins:https://jenkins.io/zh/doc/book/installing/
docker:https://hub.docker.com/search/?type=edition&offering=community

本机CentOS7.3
https://docs.docker.com/install/linux/docker-ce/centos/:

Prerequisites

OS requirements
The centos-extras repository must be enabled
This repository is enabled
The overlay2 storage driver is recommended
Uninstall old versions
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved.

Install Docker Engine - Community

Install using the repository
SET UP THE REPOSITORY
rpm -q
sudo yum install yum-utils device-mapper-persistent-data lvm2 -y
sudo yum-config-manager --add-repo docker-ce.repo
INSTALL DOCKER ENGINE - COMMUNITY

  1. Install the latest version of Docker Engine
    sudo yum install docker-ce docker-ce-cli containerd.io
  2. To install a specific version of Docker Engine
    a. yum list docker-ce --showduplicates | sort -r
    b. sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
  3. Start Docker
    sudo systemctl start docker
  4. sudo docker run hello-world

UPGRADE DOCKER ENGINE - COMMUNITY
follow the installation instructions

Install from a package
1.
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
下载rpm
2. sudo yum install /path/to/package.rpm
3. sudo systemctl start docker
4. sudo docker run hello-world

UPGRADE DOCKER ENGINE - COMMUNITY
download the newer package, using yum -y upgrade instead of yum -y install

Install using the convenience script
。。。。。。

Uninstall Docker Engine - Community

sudo yum remove docker-ce
sudo rm -rf /var/lib/docker

https://hub.docker.com/r/jenkinsci/blueocean:tag
以下47步来源

1 ADD file:aaaaaaaa in /
2 CMD ["/bin/sh"]
3 ENV LANG=C.UTF-8
4 /bin/sh -c { echo ‘#!/bin/sh’; echo ‘set -e’; echo; echo ‘dirname “$(dirname “ ( r e a d l i n k − f " (readlink -f " (readlinkf"(which javac || which java)”)”)"’; } > /usr/local/bin/docker-java-home && chmod +x /usr/local/bin/docker-java-home
5 ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
6 ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
7 ENV JAVA_VERSION=8u212
8 ENV JAVA_ALPINE_VERSION=8.212.04-r0
9 /bin/sh -c set -x && apk add --no-cache openjdk8=“KaTeX parse error: Expected 'EOF', got '&' at position 23: …PINE_VERSION" &̲& [ "JAVA_HOME” = “$(docker-java-home)” ]
10 /bin/sh -c apk add --no-cache git openssh-client curl unzip bash ttf-dejavu coreutils tini
11 ARG user=jenkins
12 ARG group=jenkins
13 ARG uid=1000
14 ARG gid=1000
15 ARG http_port=8080
16 ARG agent_port=50000
17 ARG JENKINS_HOME=/var/jenkins_home
18 ARG REF=/usr/share/jenkins/ref
19 ENV JENKINS_HOME=/var/jenkins_home
20 ENV REF=/usr/share/jenkins/ref
21 ENV REF=/usr/share/jenkins/ref
22 |6 agent_port=50000 gid=1000 group=jenkins http_port=8080 uid=1000 user=jenkins /bin/sh -c mkdir -p $JENKINS_HOME && chown u i d : {uid}: uid:{gid} $JENKINS_HOME && addgroup -g ${gid} KaTeX parse error: Expected 'EOF', got '&' at position 11: {group} &̲& adduser -h "JENKINS_HOME" -u ${uid} -G ${group} -s /bin/bash -D ${user}
23 VOLUME [/var/jenkins_home]
24 |6 agent_port=50000 gid=1000 group=jenkins http_port=8080 uid=1000 user=jenkins /bin/sh -c mkdir -p ${REF}/init.groovy.d
25 ARG JENKINS_VERSION
26 ENV JENKINS_VERSION=2.190.1
27ARG JENKINS_SHA=2d71b8f87c8417f9303a73d52901a59678ee6c0eefcf7325efed6035ff39372a
28 ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.190.1/jenkins-war-2.190.1.war
29 |8 JENKINS_SHA=46fb1d25d9423fc66aadd648dc74b9772863a7fbbd89bfc14c873cd0c3436f05 JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.190.1/jenkins-war-2.190.1.war agent_port=50000 gid=1000 group=jenkins http_port=8080 uid=1000 user=jenkins /bin/sh -c curl -fsSL KaTeX parse error: Expected 'EOF', got '&' at position 51: …/jenkins.war &̲& echo "{JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c -
30 ENV JENKINS_UC=https://updates.jenkins.io
31 ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
32 ENV JENKINS_INCREMENTALS_REPO_MIRROR=https://repo.jenkins-ci.org/incrementals
33 |8 JENKINS_SHA=46fb1d25d9423fc66aadd648dc74b9772863a7fbbd89bfc14c873cd0c3436f05 JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/2.190.1/jenkins-war-2.190.1.war agent_port=50000 gid=1000 group=jenkins http_port=8080 uid=1000 user=jenkins /bin/sh -c chown -R ${user} “ J E N K I N S H O M E " " JENKINS_HOME" " JENKINSHOME""REF”
34 EXPOSE 8080
35 EXPOSE 50000
36 ENV COPY_REFERENCE_FILE_LOG=/var/jenkins_home/copy_reference_file.log
37 USER jenkins
38 COPY file:aaaaaaaaaaaaaaaa in /usr/local/bin/jenkins-support
39 COPY file:aaaaaaaaaaaaaaaa in /usr/local/bin/jenkins.sh
40 COPY file:aaaaaaaaaaaaaaaa in /bin/tini
41 ENTRYPOINT ["/sbin/tini" “–” “/usr/local/bin/jenkins.sh”]
42 COPY file:aaaaaaaaaaaaaaaa in /usr/local/bin/plugins.sh
43 COPY file:aaaaaaaaaaaaaaaa in /usr/local/bin/install-plugins.sh
44 USER root
45 /bin/sh -c apk -U add docker
46 USER jenkins
47 /bin/sh -c install-plugins.sh antisamy-markup-formatter matrix-auth blueocean:$BLUEOCEAN_VERSION

#使用以下docker run 命令将jenkinsci/blueocean 镜像作为Docker中的容器运行
docker run
-u root
–rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean

WARNING: IPv4 forwarding is disabled. Networking will not work
解决办法:https://www.jianshu.com/p/82067b8c0190
/etc/sysctl.conf增加net.ipv4.ip_forward=1(暂不处理,影响systemctl)

浏览器打不开端口
http://istester.com/article/140.html
chown -R 1000:1000 /home/jenkins 权限账号问题
systemctl restart network && systemctl restart docker 重启

设置向导
http://localhost:8080 解锁 Jenkins
1 从Jenkins控制台日志输出中,复制自动生成的字母数字密码(在两组星号之间)
/var/jenkins_home/secrets/initialAdminPassword
find / -name initialAdminPassword
2 在 Customize Jenkins 页面内, 您可以安装任何数量的有用插件作为您初始步骤的一部分
3 创建第一个管理员用户
可能显示 Jenkins几乎准备好了! 相反,如果是这样,请单击 重启

你已跳过创建admin用户的步骤。要登录请使用用户名:‘admin’ 及用于访问安装向导的管理员密码
06abcc5d9eb24ca5a6fe51df5456e190

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐