<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:'微软雅黑', 'Microsoft YaHei';">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:'微软雅黑', 'Microsoft YaHei';">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:'微软雅黑', 'Microsoft YaHei';"><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:'Courier New';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:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';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:'Courier New';"></span></p>
<pre class="blockcode">curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version</pre>
<p style="text-align:left;"><span style="font-family:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';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:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';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:'Courier New';color:rgb(51,51,51);"></span></p>
<pre class="brush:bash;toolbar:false"># vim /usr/local/harbor/harbor.cfg
hostname = 192.168.0.131 #可以是自己的harbor域名,也可以是本机的IP
harbor_admin_password = Harbor12345 #harbor登陆密码</pre>
<p style="text-align:left;"><span style="font-size:13px;font-family:'Courier New';color:rgb(51,51,51);"></span><br></p>
<p style="text-align:left;"><span style="font-family:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';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:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';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 = /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;">{"insecure-registries": ["http://192.168.0.18"]}</span></p>
<p style="text-align:left;"><span style="font-size:20px;font-weight:bold;font-family:'微软雅黑', 'Microsoft YaHei';">3 git部署</span><br></p>
<p style="text-align:left;"><span style="font-family:'微软雅黑', 'Microsoft YaHei';"><strong><span style="font-family:'微软雅黑', 'Microsoft YaHei';font-weight:bold;font-size:14px;">3.1 部署</span></strong></span></p>
<p style="text-align:left;"><span style="font-fami |
|