harbor安裝

来源:https://www.cnblogs.com/helong-123/archive/2022/07/20/16497148.html
-Advertisement-
Play Games

鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站 系統版本:CentOS Linux release 7.6.1810 (Core) docker版本:20.10.12 docker-compose版本:v2.3.2 一、安裝docker-compose: 把在百度網盤下載的docker-com ...


鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站

系統版本:CentOS Linux release 7.6.1810 (Core)

docker版本:20.10.12

docker-compose版本:v2.3.2

一、安裝docker-compose:

把在百度網盤下載的docker-compose文件到伺服器里

[root@zabbix 14:57:42~]# chmod +x docker-compose-linux-x86_64 
[root@zabbix 14:57:48~]# mv docker-compose-linux-x86_64 /usr/local/sbin/docker-compose

二、安裝harbor

1、上傳在百度網盤下載的harbor壓縮包文件到伺服器里:

[root@zabbix 14:58:29/data/recycle]# ll
total 1237904
-rw-r--r-- 1 root root 612698835 Mar  9 14:59 harbor-offline-installer-v2.4.1.tgz
[root@zabbix 14:59:20/data/recycle]#

2、解壓harbor:

[root@zabbix 14:59:20/data/recycle]# tar zxf harbor-offline-installer-v2.4.1.tgz 
[root@zabbix 14:59:30/data/recycle]# ll
total 1237908
drwxr-xr-x 2 root root      4096 Mar  9 14:59 harbor
-rw-r--r-- 1 root root 612698835 Mar  9 14:59 harbor-offline-installer-v2.4.1.tgz

3、移動到部署目錄:

[root@zabbix 14:59:47/data/recycle]# mv harbor /data/software/
[root@zabbix 14:59:54/data/recycle]# cd /data/software/harbor/
[root@zabbix 15:00:00/data/software/harbor]# ll
total 601612
-rw-r--r-- 1 root root      3361 Dec 16 12:22 common.sh
-rw-r--r-- 1 root root 616006217 Dec 16 12:23 harbor.v2.4.1.tar.gz
-rw-r--r-- 1 root root      8999 Dec 16 12:22 harbor.yml.tmpl
-rwxr-xr-x 1 root root      2500 Dec 16 12:22 install.sh
-rw-r--r-- 1 root root     11347 Dec 16 12:22 LICENSE
-rwxr-xr-x 1 root root      1881 Dec 16 12:22 prepare

4、修改配置文件

[root@zabbix 15:00:06/data/software/harbor]# cp harbor.yml.tmpl harbor.yml

vim harbor.yml

file

5、修改daemon,並添加http的通信地址,不然docker預設使用https進行通信,如果配置了https協議就不需要添加

## 如果不修改,可能會碰到如下錯誤,只是不一定
## [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". 
[root@zabbix 16:08:52/data/software/harbor]# cat /etc/docker/daemon.json 
{
    "registry-mirrors": ["https://nr240upq.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn", "https://dockerhub.azk8s.cn", "http://hub-mirror.c.163.com"],
    "exec-opts": ["native.cgroupdriver=systemd"],
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "100m"
    },
    "insecure-registries": ["172.17.0.100:5000"]
}
[root@zabbix 16:16:59/data/software/harbor]# 

file

改好之後,重新載入配置和重啟docker

[root@zabbix 15:00:50/data/software/harbor]# systemctl daemon-reload && systemctl restart docker

6、執行部署腳本:./install.sh

[root@zabbix 15:03:56/data/software/harbor]# ./install.sh 
 
[Step 0]: checking if docker is installed ...
 
Note: docker version: 20.10.12
 
[Step 1]: checking docker-compose is installed ...
 
Note: docker-compose version: 2.3.2
 
[Step 2]: loading Harbor images ...
1e3f0dc884e2: Loading layer [==================================================>]  39.45MB/39.45MB
3fd9ccd5eeaa: Loading layer [==================================================>]  5.275MB/5.275MB
c600bceee2f7: Loading layer [==================================================>]  4.096kB/4.096kB
724cd8711815: Loading layer [==================================================>]  3.072kB/3.072kB
d7c82a981c89: Loading layer [==================================================>]  17.32MB/17.32MB
a814341c2c44: Loading layer [==================================================>]  18.12MB/18.12MB
Loaded image: goharbor/registry-photon:v2.4.1
b00595b6932d: Loading layer [==================================================>]   5.27MB/5.27MB
e34892d856ce: Loading layer [==================================================>]  5.928MB/5.928MB
ac5a22c6047d: Loading layer [==================================================>]  14.47MB/14.47MB
3d1ac12eb215: Loading layer [==================================================>]  29.29MB/29.29MB
394b4b2ea0fa: Loading layer [==================================================>]  22.02kB/22.02kB
bb0deb7416e0: Loading layer [==================================================>]  14.47MB/14.47MB
Loaded image: goharbor/notary-signer-photon:v2.4.1
c3b02aec560c: Loading layer [==================================================>]  8.422MB/8.422MB
4d5b3acd128e: Loading layer [==================================================>]  3.584kB/3.584kB
7afbf44c3706: Loading layer [==================================================>]   2.56kB/2.56kB
31f95ac6eb9a: Loading layer [==================================================>]  75.59MB/75.59MB
8981a12f5c17: Loading layer [==================================================>]  5.632kB/5.632kB
16eb0821dcc3: Loading layer [==================================================>]  96.26kB/96.26kB
b19eba29a0de: Loading layer [==================================================>]  11.78kB/11.78kB
f0785d2e9965: Loading layer [==================================================>]  76.49MB/76.49MB
26ce29b9d7ab: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.4.1
59e3814aa5f1: Loading layer [==================================================>]  119.8MB/119.8MB
1e99e9cd580e: Loading layer [==================================================>]  3.072kB/3.072kB
2bab205001c7: Loading layer [==================================================>]   59.9kB/59.9kB
c51450af480c: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.4.1
3636ff090145: Loading layer [==================================================>]  8.421MB/8.421MB
fa3d57c372c8: Loading layer [==================================================>]  3.584kB/3.584kB
a2c97825dcbf: Loading layer [==================================================>]   2.56kB/2.56kB
366b1363b528: Loading layer [==================================================>]  86.95MB/86.95MB
3d2fd6d13a0f: Loading layer [==================================================>]  87.74MB/87.74MB
Loaded image: goharbor/harbor-jobservice:v2.4.1
8f71cf8bc1c6: Loading layer [==================================================>]  5.275MB/5.275MB
5cb3457d8e25: Loading layer [==================================================>]  4.096kB/4.096kB
02c18fad9dc6: Loading layer [==================================================>]  17.32MB/17.32MB
7bbcea1ec44e: Loading layer [==================================================>]  3.072kB/3.072kB
f2842e1ada70: Loading layer [==================================================>]  28.69MB/28.69MB
4665575c3f9e: Loading layer [==================================================>]  46.81MB/46.81MB
Loaded image: goharbor/harbor-registryctl:v2.4.1
439595cfbbc0: Loading layer [==================================================>]  7.192MB/7.192MB
Loaded image: goharbor/nginx-photon:v2.4.1
a19de03ace6b: Loading layer [==================================================>]   5.27MB/5.27MB
35bbd4cf35b6: Loading layer [==================================================>]  5.928MB/5.928MB
88f852ebd746: Loading layer [==================================================>]  15.88MB/15.88MB
e3c0db81a28c: Loading layer [==================================================>]  29.29MB/29.29MB
f74e521b7a55: Loading layer [==================================================>]  22.02kB/22.02kB
7d97a705f439: Loading layer [==================================================>]  15.88MB/15.88MB
Loaded image: goharbor/notary-server-photon:v2.4.1
1e6473070b18: Loading layer [==================================================>]    124MB/124MB
f05c1a477d2d: Loading layer [==================================================>]  3.584kB/3.584kB
bcab3e00aa98: Loading layer [==================================================>]  3.072kB/3.072kB
970d569f474a: Loading layer [==================================================>]   2.56kB/2.56kB
c659c9812277: Loading layer [==================================================>]  3.072kB/3.072kB
9d401ff8bf07: Loading layer [==================================================>]  3.584kB/3.584kB
968dfed00d2e: Loading layer [==================================================>]  19.97kB/19.97kB
Loaded image: goharbor/harbor-log:v2.4.1
b64000a1cd2c: Loading layer [==================================================>]  1.097MB/1.097MB
e3fb7ac15701: Loading layer [==================================================>]  5.889MB/5.889MB
d6e7f8008582: Loading layer [==================================================>]  165.9MB/165.9MB
eff0812a8c6f: Loading layer [==================================================>]  15.07MB/15.07MB
91a6abd7a540: Loading layer [==================================================>]  4.096kB/4.096kB
47e875926154: Loading layer [==================================================>]  6.144kB/6.144kB
04876e025d4a: Loading layer [==================================================>]  3.072kB/3.072kB
b817a88114e6: Loading layer [==================================================>]  2.048kB/2.048kB
e5fb37021dff: Loading layer [==================================================>]   2.56kB/2.56kB
767486d5c318: Loading layer [==================================================>]   2.56kB/2.56kB
b92f2b842b46: Loading layer [==================================================>]   2.56kB/2.56kB
e90e3a7ea4e9: Loading layer [==================================================>]  8.704kB/8.704kB
Loaded image: goharbor/harbor-db:v2.4.1
daf3d38cddc8: Loading layer [==================================================>]  8.422MB/8.422MB
8013b2cbc0b9: Loading layer [==================================================>]  18.13MB/18.13MB
4445f5ea7083: Loading layer [==================================================>]  4.608kB/4.608kB
32e035f0af8e: Loading layer [==================================================>]  18.93MB/18.93MB
Loaded image: goharbor/harbor-exporter:v2.4.1
0ad72e88d766: Loading layer [==================================================>]   8.54MB/8.54MB
fe195f48d47b: Loading layer [==================================================>]  4.096kB/4.096kB
71f2671db231: Loading layer [==================================================>]  3.072kB/3.072kB
ddda0b4a8eae: Loading layer [==================================================>]  39.27MB/39.27MB
c3fe76027866: Loading layer [==================================================>]  12.37MB/12.37MB
d82a7403c39a: Loading layer [==================================================>]  52.43MB/52.43MB
Loaded image: goharbor/trivy-adapter-photon:v2.4.1
03e449493f09: Loading layer [==================================================>]  5.275MB/5.275MB
4f4a25c7cc0d: Loading layer [==================================================>]   64.5MB/64.5MB
77a37df05436: Loading layer [==================================================>]  3.072kB/3.072kB
47c58e48962d: Loading layer [==================================================>]  4.096kB/4.096kB
5dd56c28f3fc: Loading layer [==================================================>]  65.29MB/65.29MB
Loaded image: goharbor/chartmuseum-photon:v2.4.1
8b7cbddd8918: Loading layer [==================================================>]  165.6MB/165.6MB
b8157b6f7cb8: Loading layer [==================================================>]   57.6MB/57.6MB
4a53b9a92b30: Loading layer [==================================================>]   2.56kB/2.56kB
59184fc56c3c: Loading layer [==================================================>]  1.536kB/1.536kB
99431fe2c10f: Loading layer [==================================================>]  12.29kB/12.29kB
3735b7f4881f: Loading layer [==================================================>]   2.62MB/2.62MB
bcff3633b236: Loading layer [==================================================>]  325.6kB/325.6kB
Loaded image: goharbor/prepare:v2.4.1
eb57d0945b2e: Loading layer [==================================================>]  7.192MB/7.192MB
dd9069fd53a8: Loading layer [==================================================>]  7.355MB/7.355MB
e779dab1d180: Loading layer [==================================================>]  1.754MB/1.754MB
Loaded image: goharbor/harbor-portal:v2.4.1
 
 
[Step 3]: preparing environment ...
 
[Step 4]: preparing harbor configs ...
prepare base dir is set to /data/software/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
 
 
 
[Step 5]: starting Harbor ...
[+] Running 10/10
 ? Network harbor_harbor        Created                                                                                            0.0s
 ? Container harbor-log         Started                                                                                            0.6s
 ? Container redis              Started                                                                                            1.3s
 ? Container registryctl        Started                                                                                            1.4s
 ? Container registry           Started                                                                                            1.4s
 ? Container harbor-db          Started                                                                                            1.4s
 ? Container harbor-portal      Started                                                                                            1.3s
 ? Container harbor-core        Started                                                                                            1.7s
 ? Container harbor-jobservice  Started                                                                                            2.3s
 ? Container nginx              Started                                                                                            2.4s
? ----Harbor has been installed and started successfully.----
[root@zabbix 15:04:47/data/software/harbor]#

7、配置開機自啟:

/usr/local/sbin/docker-compose -f /data/software/harbor/docker-compose.yml up -d

file

8、設置許可權

chmod +x /etc/rc.local /etc/rc.d/rc.local

9、嘗試登陸harbor

file

10、命令行登陸

[root@zabbix 15:08:00/data/software/harbor]# docker login 172.17.0.100:5000
Username: admin
Password: 
 
Login Succeeded
[root@zabbix 15:08:57/data/software/harbor]# 

三、測試上傳和下載

1、新建一個項目目錄:

file

file

file

file

2、我以nginx為例進行推送到harbor上:

[root@zabbix 16:45:33/data/software/harbor]# docker image ls | grep nginx
nginx                           latest     605c77e624dd   2 months ago    141MB
goharbor/nginx-photon           v2.4.1     78aad8c8ef41   2 months ago    45.7MB
[root@zabbix 16:45:42/data/software/harbor]# docker tag nginx:latest 172.17.0.100:5000/test/nginx1.8:v1
[root@zabbix 16:59:00/data/software/harbor]# docker image ls | grep nginx
172.17.0.100:5000/test/nginx1.8   v1         605c77e624dd   2 months ago    141MB
nginx                             latest     605c77e624dd   2 months ago    141MB
goharbor/nginx-photon             v2.4.1     78aad8c8ef41   2 months ago    45.7MB
[root@zabbix 16:59:04/data/software/harbor]# docker push 172.17.0.100:5000/test/nginx1.8:v1 
The push refers to repository [172.17.0.100:5000/test/nginx1.8]
d874fd2bc83b: Pushed 
32ce5f6a5106: Pushed 
f1db227348d0: Pushed 
b8d6e692a25e: Pushed 
e379e8aedd4d: Pushed 
2edcec3590a4: Pushed 
v1: digest: sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3 size: 1570
[root@zabbix 16:59:25/data/software/harbor]# 

3、查看鏡像倉庫,可以看到多了一個鏡像

file

4、鏡像拉取(鏡像下載)

[root@zabbix 16:59:25/data/software/harbor]# docker image rm 172.17.0.100:5000/test/nginx1.8:v1 
Untagged: 172.17.0.100:5000/test/nginx1.8:v1
Untagged: 172.17.0.100:5000/test/nginx1.8@sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
 
[root@zabbix 17:01:15/data/software/harbor]# docker image ls | grep nginx
nginx                           latest     605c77e624dd   2 months ago    141MB
goharbor/nginx-photon           v2.4.1     78aad8c8ef41   2 months ago    45.7MB
 
[root@zabbix 17:02:07/data/software/harbor]# docker pull 172.17.0.100:5000/test/nginx1.8:v1
v1: Pulling from test/nginx1.8
Digest: sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
Status: Downloaded newer image for 172.17.0.100:5000/test/nginx1.8:v1
172.17.0.100:5000/test/nginx1.8:v1
 
[root@zabbix 17:02:12/data/software/harbor]# docker image ls | grep nginx
172.17.0.100:5000/test/nginx1.8   v1         605c77e624dd   2 months ago    141MB
nginx                             latest     605c77e624dd   2 months ago    141MB
goharbor/nginx-photon             v2.4.1     78aad8c8ef41   2 months ago    45.7MB
[root@zabbix 17:02:16/data/software/harbor]# 

至此,harbor部署完畢

知識補充:

1、如果以後修改了harbor.yml文件,那麼先停止使用docker-compose down,再去修改harbor.yml文件,重新啟動部署 ./install.sh

2、正常啟動harbor啟動:

docker-compose up -d

3、未修改配置文件,重啟Harbor命令:docker-compose start | stop | restart

原文鏈接:https://blog.csdn.net/moyuanbomo/article/details/123378825


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 一般情況下,在Word中添加文字水印僅支持添加一個文本字樣的水印,但在複雜的辦公環境中,由於對不同文檔的設計要求,需要在Word文檔中添加平鋪水印效果,即文檔中的水印文字以多行多列分佈的形式存在。本文將介紹如何來實現該水印效果的方法,下麵是詳細步驟及方法。 dll引用 通過 NuGet 引入dll( ...
  • 一:背景 寫這一篇的目的主要是因為.NET領域內幾本關於闡述GC方面的書,都是純理論,所以懂得人自然懂,不懂得人也沒法親自驗證,這一篇我就用 windbg + 源碼 讓大家眼見為實。 二:為什麼要引入後臺GC 1. 後臺GC到底解決了什麼問題 解決什麼問題得先說有什麼問題,我們知道 阻塞版GC 有一 ...
  • 背景 在生產過程中,由於磁碟空間、保留周期等因素,會對系統、應用等日誌提出要求,要求系統日誌定期進行輪轉、壓縮和刪除,從而減少開銷,而系統自帶的logrotate 則是一個簡單又實用的小工具,下麵著重介紹一下,滿足日常需求。 語法 Usage: logrotate [OPTION...] <conf ...
  • Linux 的基本操作 -許可權 許可權: 文件的屬性: d:表示目錄-:表示文件 l:連接文件 b:設備文件,提供存儲的介面設備 c:設備文件,提供串列的介面設備--鍵盤,滑鼠 r:可讀,查看目錄下有哪些文件或文件夾,查看文件內容 w :可寫,在目錄中新普文件夾/文件 修改/刪除文件a/文件內容移動文 ...
  • less 命令: 查看文件內容 概念 less 與 more 類似,less 可以隨意瀏覽文件,支持翻頁和搜索,支持向上翻頁和向下翻頁。而使用 more 命令瀏覽文件內容時,只能不斷向後翻看。 介紹 用法: less [OPTION]... [FILE]... 常用參數: 常用選項及含義 | Key ...
  • zCommander for Mac是一款功能全面的文件管理軟體,為你提供文件列表視圖雙窗格功能,且每個窗格可以有多個選項卡,您只需使用鍵盤界面即可完成大多數文件操作,因此操作簡單且快速,為你的工作提供了不少方便! 詳情:zCommander for Mac(文件管理軟體) 功能特色 -熟悉的文件列 ...
  • 鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站 安裝前準備工作 因為Nginx依賴於gcc的編譯環境,所以,需要安裝編譯環境來使Nginx能夠編譯起來 yum install gcc-c++ Nginx的http模塊需要使用pcre來解析正則表達式,需要安裝pcre yum install - ...
  • PDF Reader Pro mac版是一款全面且強大的pdf閱讀器,該軟體支持PDF閱讀,編輯,註釋,創建/填寫表格,轉換,創建,OCR和簽署PDF文件等,滿足您的所有PDF文檔需求。簡便高效,大大提升您的工作效率。 詳情:PDF Reader Pro for mac(全能pdf閱讀器) 軟體特色 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...