<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>harbor &#8211; wqh博客</title>
	<atom:link href="https://wangqianhong.com/tag/harbor/feed/" rel="self" type="application/rss+xml" />
	<link>https://wangqianhong.com</link>
	<description>和而不同</description>
	<lastBuildDate>Sun, 22 Sep 2024 06:44:18 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wangqianhong.com/wp-content/uploads/2020/09/cropped-1-1-1-32x32.png</url>
	<title>harbor &#8211; wqh博客</title>
	<link>https://wangqianhong.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>镜像仓库Harbor（四） &#124; 镜像操作</title>
		<link>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/</link>
					<comments>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sat, 07 May 2022 09:16:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[harbor]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3112</guid>

					<description><![CDATA[<p>创建好项目并分配好用户之后，就可以在本地对镜像仓库进行操作 http访问 如果harbor还没有设置&#8230; <a href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">镜像仓库Harbor（四） &#124; 镜像操作</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/">镜像仓库Harbor（四） | 镜像操作</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>创建好项目并分配好用户之后，就可以在本地对镜像仓库进行操作</p>



<h3>http访问</h3>



<p>如果harbor还没有设置https，则需要配置docker的daemon.json文件</p>



<pre class="wp-block-preformatted">(<code>C:\ProgramData\Docker\config\daemon.json</code>&nbsp;on windows,&nbsp;<code>/etc/docker/daemon.json</code>&nbsp;on linux)

<code>"insecure-registries":["192.168.1.93:80"]</code></pre>



<p>如果配置了https，就要加入ca.crt文件</p>



<pre class="wp-block-preformatted"><code>/etc/docker/certs.d/192.168.1.93/ca.crt</code>

重启docker
<code>systemctl restart docker</code></pre>



<p>同时还要把ca.crt文件拷贝到<code>/etc/ssl/certs/</code>目录下面，否则在使用Dockerfile构建镜像会报错</p>



<pre class="wp-block-preformatted">tls: failed to verify certificate: x509: certificate signed by unknown authority</pre>



<h3>登录仓库</h3>



<pre class="wp-block-preformatted"><code>docker login 192.168.1.93 -u admin</code>
Password:

Login Succeeded</pre>



<h3>tag镜像</h3>



<p>要推送镜像到仓库，必需打上标签</p>



<pre class="wp-block-code"><code>docker tag image_id(本地需要push的镜像) ip:port/项目名/镜像名:版本号</code></pre>



<h3>推送镜像</h3>



<pre class="wp-block-code"><code>docker push ip:port/项目名/镜像名:版本号</code></pre>



<p>推送完成之后，就可以在对应项目下看到镜像</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://wangqianhong.com/wp-content/uploads/2024/06/image-5.png" alt="" class="wp-image-3132" width="868" height="210" srcset="https://wangqianhong.com/wp-content/uploads/2024/06/image-5.png 1397w, https://wangqianhong.com/wp-content/uploads/2024/06/image-5-768x186.png 768w, https://wangqianhong.com/wp-content/uploads/2024/06/image-5-850x206.png 850w" sizes="(max-width: 868px) 100vw, 868px" /></figure>



<h3>拉取镜像</h3>



<pre class="wp-block-code"><code>docker pull ip:port/项目名/镜像名:版本号</code></pre>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/">镜像仓库Harbor（四） | 镜像操作</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e5%9b%9b%ef%bc%89-%e9%95%9c%e5%83%8f%e6%93%8d%e4%bd%9c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>镜像仓库Harbor（三） &#124; https配置</title>
		<link>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/</link>
					<comments>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sun, 01 May 2022 07:42:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[harbor]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3117</guid>

					<description><![CDATA[<p>在生产环境中，应该从CA获得证书。在测试或开发环境中，可以生成自己的CA。要生成CA证书，请运行以下&#8230; <a href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">镜像仓库Harbor（三） &#124; https配置</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/">镜像仓库Harbor（三） | https配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>在生产环境中，应该从CA获得证书。在测试或开发环境中，可以生成自己的CA。要生成CA证书，请运行以下命令。</p>



<h3>停止Harbor</h3>



<p>首先将Harbor停止，并删除掉原有的一些数据，以恢复到一个干净的环境</p>



<pre class="wp-block-preformatted"><code>docker compose -f docker-compose.yml down -v</code>

<code>rm -rf /data/ca_download /data/database /data/job_logs /data/redis /data/registry /data/secret</code>
<code>rm -rf /var/log/harbor*</code></pre>



<h3>证书生成</h3>



<h4>根证书</h4>



<pre class="wp-block-code"><code>openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 3650 -out ca.crt -subj "/C=CN/ST=Guangdong/L=Shenzhen/O=company/OU=IT/CN=test/emailAddress=1@test.com"</code></pre>



<p>生成ca.crt和ca.key</p>



<h4>证书签名</h4>



<pre class="wp-block-code"><code>openssl req -newkey rsa:4096 -nodes -sha256 -keyout harbor-registry.key -out harbor-registry.csr -days 3650 -subj "/C=CN/ST=Guangdong/L=Shenzhen/O=company/OU=IT/CN=192.168.1.93/emailAddress=1@test.com"</code></pre>



<h4><strong>registry产生证书</strong></h4>



<pre class="wp-block-preformatted"><code>echo subjectAltName = IP:192.168.1.93 &gt; extfile.cnf</code>

<code>openssl x509 -req -days 3650 -in harbor-registry.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extfile extfile.cnf -out harbor-registry.crt</code>

<code>ls </code>
ca.crt ca.key ca.srl extfile.cnf harbor-registry.crt harbor-registry.csr harbor-registry.key</pre>



<h3>修改配置</h3>



<p>修改harbor.yml</p>



<pre class="wp-block-preformatted"><strong>https</strong>:
  # https port for harbor, default is 443
<strong>  port</strong>: 443
  # The path of cert and key files for nginx
<strong>  certificate</strong>: /you/path/harbor-registry.crt
<strong>  private_key</strong>: /you/path/harbor-registry.key
  # enable strong ssl ciphers (default: false)
  # strong_ssl_ciphers: false</pre>



<p>重新生成配置文件</p>



<pre class="wp-block-code"><code>./prepare </code></pre>



<h3>重启Harbor</h3>



<pre class="wp-block-preformatted"><code>docker compose -f docker-compose.yml up -d</code>

Creating harbor-log ... done
Creating harbor-db ... done
Creating registryctl ... done
Creating registry ... done
Creating harbor-portal ... done
Creating redis ... done
Creating harbor-core ... done
Creating nginx ... done
Creating harbor-jobservice ... done</pre>



<h3>通过https访问</h3>



<p>将上面产生的<strong>ca.crt</strong>导入到浏览器的<strong>受信任的根证书</strong>中。然后就可以通过https进行访问</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/">镜像仓库Harbor（三） | https配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/05/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%89%ef%bc%89-https%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>镜像仓库Harbor（二） &#124; 仓库管理</title>
		<link>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/</link>
					<comments>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Thu, 21 Apr 2022 05:26:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[harbor]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3103</guid>

					<description><![CDATA[<p>Harbor通过多用户角色来实现权限控制 创建用户 系统管理 -&#62; 用户管理 角色管理 系统管&#8230; <a href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">镜像仓库Harbor（二） &#124; 仓库管理</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/">镜像仓库Harbor（二） | 仓库管理</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Harbor通过多用户角色来实现权限控制</p>



<h3>创建用户</h3>



<p>系统管理 -&gt; 用户管理</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="571" height="465" src="https://wangqianhong.com/wp-content/uploads/2024/06/image-2.png" alt="" class="wp-image-3108" srcset="https://wangqianhong.com/wp-content/uploads/2024/06/image-2.png 571w, https://wangqianhong.com/wp-content/uploads/2024/06/image-2-368x300.png 368w" sizes="(max-width: 571px) 100vw, 571px" /></figure>



<h3>角色管理</h3>



<figure class="wp-block-image size-large"><img loading="lazy" width="539" height="294" src="https://wangqianhong.com/wp-content/uploads/2024/06/image-1.png" alt="" class="wp-image-3106"/></figure>



<ul><li><strong>系统管理员：</strong>即admin用户，Harbor 系统管理员”拥有最多的权限，它可以列出所有项目、设置普通用户为管理员、删除用户以及为所有镜像设置漏洞扫描策略。所有项目也归管理员所有</li><li><strong>项目管理员：</strong>当系统管理员（admin）给某个用户“项目管理员”的角色后，该用户即可以”项目管理员“的身份管理该项目，其它未分配的项目无权限，”项目管理员“项目管理员有镜像上传/拉取、添加/删除成员、Helm Chart上传/下载、配置管理等权限。该角色在实际的业务场景通常是分配给某个项目的负责人</li><li><strong>维护人员：</strong>维护者拥有超越“开发者”的权限，包括扫描镜像、查看复制任务以及删除镜像和Helm Chart上传/下载、删除的能力</li><li><strong>开发者：</strong>开发者拥有项目的读写权限，即上传镜像到该项目和从该项目拉取镜像、上传/下载HelmChart、查看日志，其它权限没有</li><li><strong>访客：</strong>访客对指定项目具有只读权限。他们可以拉取和重新标记图像，但不能推送，也可以登录Harbor UI界面</li><li><strong>受限访客：</strong>受限访客没有项目的完全读取权限。他们可以拉取图像但不能推送，而且他们看不到日志或项目的其他成员。例如，您可以为来自不同组织的共享项目访问权限的用户创建受限访客</li></ul>



<h3>项目管理</h3>



<p>新建项目</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://wangqianhong.com/wp-content/uploads/2024/06/image-4.png" alt="" class="wp-image-3114" width="606" height="420" srcset="https://wangqianhong.com/wp-content/uploads/2024/06/image-4.png 558w, https://wangqianhong.com/wp-content/uploads/2024/06/image-4-433x300.png 433w" sizes="(max-width: 606px) 100vw, 606px" /></figure>



<p>创建好不同角色的用户之后，就可以为不同的项目分配不同的用户，实现不同的限制控制</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://wangqianhong.com/wp-content/uploads/2024/06/image-3.png" alt="" class="wp-image-3110" width="634" height="218" srcset="https://wangqianhong.com/wp-content/uploads/2024/06/image-3.png 982w, https://wangqianhong.com/wp-content/uploads/2024/06/image-3-768x264.png 768w, https://wangqianhong.com/wp-content/uploads/2024/06/image-3-850x292.png 850w" sizes="(max-width: 634px) 100vw, 634px" /></figure>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/">镜像仓库Harbor（二） | 仓库管理</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%ba%8c%ef%bc%89-%e4%bb%93%e5%ba%93%e7%ae%a1%e7%90%86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>镜像仓库Harbor（一） &#124; 容器部署</title>
		<link>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/</link>
					<comments>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sun, 17 Apr 2022 09:17:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[harbor]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3082</guid>

					<description><![CDATA[<p>Harbor（https://goharbor.io/）是一个开源的企业级镜像管理工具，它提供了一个&#8230; <a href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">镜像仓库Harbor（一） &#124; 容器部署</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/">镜像仓库Harbor（一） | 容器部署</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Harbor（<a href="https://goharbor.io/" target="_blank" rel="noreferrer noopener">https://goharbor.io/</a>）是一个开源的企业级镜像管理工具，它提供了一个安全、可靠、可扩展的平台，用于存储、管理和分发Docker镜像。Harbor 允许用户用命令行工具对容器镜像及其他 Artifact 进行推送和拉取，并提供了图形管理界面帮助用户查看和管理这些 Artifact。</p>



<h3>基本介绍</h3>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://wangqianhong.com/wp-content/uploads/2024/06/image.png" alt="" class="wp-image-3088" width="646" height="386" srcset="https://wangqianhong.com/wp-content/uploads/2024/06/image.png 800w, https://wangqianhong.com/wp-content/uploads/2024/06/image-768x460.png 768w, https://wangqianhong.com/wp-content/uploads/2024/06/image-501x300.png 501w" sizes="(max-width: 646px) 100vw, 646px" /></figure>



<p><strong>代理层</strong>：代理层实质上是一个 Nginx 反向代理，负责接收不同类型的客户端请求，包括浏览器、用户脚本、Docker 等，并根据请求类型和 URI 转发给不同的后端服务进行处理。</p>



<p><strong>功能层</strong>：</p>



<ul><li><strong>Portal：</strong>是一个基于 Argular 的前端应用，提供 Harbor 用户访问的界面。</li><li><strong>Core：</strong>是 Harbor 中的核心组件，封装了 Harbor 绝大部分的业务逻辑。</li><li><strong>JobService</strong>：异步任务组件，负责 Harbor 中很多比较耗时的功能，比如 Artifact 复制、扫描、垃圾回收等。</li><li><strong>Docker Distribution：</strong>Harbor 通过 Distribution 实现 Artifact 的读写和存取等功能。</li><li><strong>RegistryCtl</strong>：Docker Distribution 的控制组件。</li><li><strong>Notary（可选）：</strong>基于 TUF 提供镜像签名管理的功能。</li><li><strong>扫描工具（可选）：</strong>镜像的漏洞检测工具。</li><li><strong>ChartMuseum（可选）：</strong>提供 API 管理非 OCI 规范的 Helm Chart，随着兼容 OCI 规范的 Helm Chart 在社区上被更广泛地接受，Helm Chart 能以 Artifact 的形式在 Harbor 中存储和管理，不再依赖 ChartMuseum，因此 Harbor 可能会在后续版本中移除对 ChartMuseum 的支持。</li></ul>



<p><strong>数据层</strong>：</p>



<ul><li><strong>Redis</strong>：主要作为缓存服务存储一些生命周期较短的数据，同时对于 JobService 还提供了类似队列的功能。</li><li><strong>PostgreSQL</strong>：存储 Harbor 的应用数据，比如项目信息、用户与项目的关系、管理策略、配置信息、Artifact 的元数据等等。</li><li><strong>Artifact 存储</strong>：存储 Artifact 本身的内容，也就是每次推送镜像、Helm Chart 或其他 Artifact 时，数据最终存储的地方。默认情况下，Harbor 会把 Artifact 写入本地文件系统中。用户也可以修改配置，将 Artifact 存储在外部存储中，例如亚马逊的对象存储 S3、谷歌云存储 GCS、阿里云的对象存储 OSS 等等。</li></ul>



<h3>前期准备</h3>



<p>所有的容器都跑在docker上面</p>



<figure class="wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-wqh博客"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="Hne3EGIix1"><a href="https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/">Centos8安装Docker</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" title="《Centos8安装Docker》—wqh博客" src="https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/embed/#?secret=Hne3EGIix1" data-secret="Hne3EGIix1" width="500" height="282" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<p><a href="https://github.com/goharbor/harbor/releases/tag/v2.10.2" target="_blank" rel="noreferrer noopener">https://github.com/goharbor/harbor/releases/tag/v2.10.2</a>，下载最新的offline版本，然后上传到服务器</p>



<pre class="wp-block-code"><code>tar -zxvf harbor-offline-installer-v2.10.2.tgz</code></pre>



<h3>修改配置</h3>



<pre class="wp-block-code"><code>cp harbor.yml.tmpl harbor.yml</code></pre>



<pre class="wp-block-preformatted"><strong>hostname</strong>: 192.168.1.93

# http related config
<strong>http</strong>:
# port for http, default is 80. If https enabled, this port will redirect to https port
<strong>port</strong>: 80

# https related config
#https:
# https port for harbor, default is 443
#port: 443
# The path of cert and key files for nginx
#certificate: /your/certificate/path
#private_key: /your/private/key/path
# enable strong ssl ciphers (default: false)
# strong_ssl_ciphers: false

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
<strong>harbor_admin_password</strong>: Harbor12345

# Harbor DB configuration
<strong>database</strong>:
  # The password for the root user of Harbor DB. Change this before any production use.
  <strong>password</strong>: root123</pre>



<p>hostname 修改成自己的可以访问的服务器地址</p>



<p>port 可以访问的端口，默认是80</p>



<p>harbor_admin_password 管理账号密码</p>



<p>password 数据库密码</p>



<p>把https暂时注释掉</p>



<h3>脚本安装</h3>



<pre class="wp-block-code"><code> bash install.sh</code></pre>



<pre class="wp-block-preformatted"><strong>[Step 0]: checking if docker is installed ...</strong>

<strong>Note:</strong> docker version: 24.0.5

<strong>[Step 1]: checking docker-compose is installed ...</strong>

<strong>Note:</strong> docker-compose version: 1.25.0

<strong>[Step 2]: loading Harbor images ...</strong>
Loaded image: goharbor/harbor-db:v2.10.2
Loaded image: goharbor/harbor-jobservice:v2.10.2
Loaded image: goharbor/redis-photon:v2.10.2
Loaded image: goharbor/registry-photon:v2.10.2
Loaded image: goharbor/harbor-log:v2.10.2
Loaded image: goharbor/harbor-portal:v2.10.2
Loaded image: goharbor/harbor-core:v2.10.2
Loaded image: goharbor/harbor-registryctl:v2.10.2
Loaded image: goharbor/harbor-exporter:v2.10.2
Loaded image: goharbor/nginx-photon:v2.10.2
Loaded image: goharbor/trivy-adapter-photon:v2.10.2
Loaded image: goharbor/prepare:v2.10.2

<strong>[Step 3]: preparing environment ...</strong>

<strong>[Step 4]: preparing harbor configs ...</strong>
prepare base dir is set to /home/forenet/harbor

<strong>[Step 5]: starting Harbor ...</strong>
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db ... done
Creating registry ... done
Creating harbor-portal ... done
Creating redis ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
✔ ----Harbor has been installed and started successfully.----</pre>



<p>到这里Harbor就全部安装好了</p>



<p>访问：<code>http://192.168.1.93</code>&nbsp;账号/密码：<code>admin/Harbor12345</code></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/">镜像仓库Harbor（一） | 容器部署</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/04/%e9%95%9c%e5%83%8f%e4%bb%93%e5%ba%93harbor%ef%bc%88%e4%b8%80%ef%bc%89-%e5%ae%b9%e5%99%a8%e9%83%a8%e7%bd%b2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
