Jenkins+harbor+docker的CICD

论坛 期权论坛     
选择匿名的用户   2021-6-2 15:46   610   0
<div class="artical-content-bak main-content editor-side-new">
<div class="con editor-preview-side" id="result">
  <p style="text-align:left;"><span style="font-size:20px;font-weight:bold;font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;">1、 实验环境</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">192.168.0.18  git /harbor</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">192.168.0.19 jenkins</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">192.168.0.20 docker</span></p>
  <p><br></p>
  <p style="text-align:left;"><span style="font-size:20px;font-weight:bold;font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;">2、harbor 环境搭建</span></p>
  <p><span style="font-size:20px;font-family:SimSun, STSong;font-weight:bold;"></span></p>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-weight:bold;font-size:14px;">2.1 安装docker-ce(三台服务器都安装上)</span></strong></span></p>
  <p><span style="font-size:13px;font-family:&#39;Courier New&#39;;color:rgb(51,51,51);"></span></p>
  <pre class="blockcode">yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
rm -rf /var/lib/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 docker-ce-cli containerd.io

systemctl start docker</pre>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">2.2 安装docker-compose</span></strong></span><span style="font-size:20px;font-family:SimSun, STSong;font-weight:bold;"><br></span></p>
  <p><span style="font-size:13px;font-family:&#39;Courier New&#39;;"></span></p>
  <pre class="blockcode">curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-&#96;uname -s&#96;-&#96;uname -m&#96; -o /usr/local/bin/docker-compose

chmod &#43;x /usr/local/bin/docker-compose

docker-compose --version</pre>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">2.3 安装harbor</span></strong></span></p>
  <pre class="blockcode">wget   https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-offline-installer-v1.2.0.tgz

# cd /usr/local/src/
# tar zxf harbor-online-installer-v1.2.0.tgz  -C /usr/local/
# cd /usr/local/harbor/</pre>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">2.4 修改配置文件</span></strong></span><br></p>
  <p style="text-align:left;"><span style="font-size:13px;font-family:&#39;Courier New&#39;;color:rgb(51,51,51);"></span></p>
  <pre class="brush:bash;toolbar:false"># vim /usr/local/harbor/harbor.cfg

hostname &#61; 192.168.0.131   #可以是自己的harbor域名,也可以是本机的IP
harbor_admin_password &#61; Harbor12345  #harbor登陆密码</pre>
  <p style="text-align:left;"><span style="font-size:13px;font-family:&#39;Courier New&#39;;color:rgb(51,51,51);"></span><br></p>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">2.5 安装harbor</span></strong></span><br></p>
  <pre class="brush:bash;toolbar:false"># ./preper.sh
# ./install.sh</pre>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">2.6 注意事项</span></strong></span><br></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">需要注意的是关于adminserver容器一直重启的问题:</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">harbor.cfg 配置中secretkey_path &#61; /data 不要修改目录,如果修改了目录,需要chown 10000:10000 /mydir/secretkey</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">另外需要添加daemon.json</span></p>
  <p style="text-align:left;"><span style="font-family:SimSun, STSong;">{&#34;insecure-registries&#34;: [&#34;http://192.168.0.18&#34;]}</span></p>
  <p style="text-align:left;"><span style="font-size:20px;font-weight:bold;font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;">3 git部署</span><br></p>
  <p style="text-align:left;"><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;"><strong><span style="font-family:&#39;微软雅黑&#39;, &#39;Microsoft YaHei&#39;;font-weight:bold;font-size:14px;">3.1 部署</span></strong></span></p>
  <p style="text-align:left;"><span style="font-fami
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP