harbor特性
基于角色的訪問控制:用戶和存儲庫是通過“項目”組織的玩祟,用戶可以對多個鏡像倉庫統(tǒng)一命名空間擁有不同的權(quán)限。
鏡像復(fù)制:可以基于具有多個Registry實例之間復(fù)制(同步)圖像和圖表。如果出現(xiàn)任何錯誤,Harbor會自動重試復(fù)制将塑。非常適合于負(fù)載平衡褥赊、高可用性跛蛋、多數(shù)據(jù)中心熬的、混合和多云場景。
- LDAP/AD支持:Harbor與現(xiàn)有企業(yè)LDAP/AD集成赊级,用于用戶身份驗證和管理押框,并支持將LDAP組導(dǎo)入Harbor并為其分配適當(dāng)?shù)捻椖拷巧?/li>
鏡像刪除和垃圾收集:鏡像可以刪除,其空間可以回收理逊。
國際化:對多國語言支持(已擁有中文橡伞、英文、德文晋被、日語和俄文)兑徘;
圖形化用戶界面:用戶可以輕松瀏覽、搜索存儲庫和管理項目羡洛。
審計管理:跟蹤到存儲庫的所有操作挂脑。
RESTful API:用于大多數(shù)管理操作的RESTful API,易于與外部系統(tǒng)集成欲侮。一個嵌入式的Swagger用戶界面可用于探索和測試API崭闲。
簡單部署:提供在線和離線安裝程序。此外威蕉,可以安裝到vSphere平臺的(OVA方式)虛擬設(shè)備刁俭。
Harbor 組件
- proxy:Harbor的組件,如注冊表韧涨、UI和令牌服務(wù)牍戚,都位于反向代理之后。代理將來自瀏覽器和Docker客戶機的請求轉(zhuǎn)發(fā)到各種后端服務(wù)虑粥。
- Registry:負(fù)責(zé)存儲Docker鏡像和處理Docker推/拉命令翘魄。由于Harbor需要對映像進(jìn)行訪問權(quán)限控制,Registry將引導(dǎo)客戶機訪問令牌服務(wù)舀奶,以便為每個pull或push請求獲取有效的令牌(token)。
-
Core Service:Harbor的核心功能斋射,主要提供以下服務(wù):
UI:提供圖像化的圖形用戶界面育勺,幫助人戶管理鏡像和對用戶授權(quán)。
webhook: 為了及時獲取registry上images的狀態(tài)變化的情況罗岖,在Registry上配置webhook涧至,把狀態(tài)變化傳遞UI模塊;
Token令牌服務(wù):負(fù)責(zé)根據(jù)用戶在項目中的角色為每個docker push/pull命令頒發(fā)令牌桑包。如果從Docker客戶機發(fā)送的請求中沒有令牌南蓬,注冊表將把請求重定向到令牌服務(wù)。
Datebase:為了給core services提供數(shù)據(jù)庫舒服,負(fù)責(zé)儲存用戶權(quán)限赘方、審計日志烧颖、Docker image分組信息等數(shù)據(jù)。
Job Services:提供鏡像遠(yuǎn)程負(fù)責(zé)功能窄陡,能把本地鏡像同步到其他harbor實例當(dāng)中炕淮。
Log Collector:為了幫助監(jiān)控Harbor運行,負(fù)責(zé)手機其他組件的log跳夭,供日后分析涂圆。
harbor 安裝
harbor github 地址 https://github.com/goharbor/harbor
harbor 官方安裝教程
下載tar包
放到在相應(yīng)的目錄/usr/local/docker/
解壓
tar xvf harbor-offline-installer-<version>.tgz
解壓后 獲取的文件夾及文件
修改harbor.yml配置
修改主機ip 但是不能使用127.0.0.1
or localhost
默認(rèn)賬號密碼admin/Harbor12345
這里修改密碼改成123456
配置日志和data地址按實際來配置
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 120.79.10.212
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 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
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433
# 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.
harbor_admin_password: 123456
# Harbor DB configuration
database:
# The password for the root user of Harbor DB. Change this before any production use.
password: 123456
# The default data volume
data_volume: /usr/local/docker/harbor/data
# Harbor Storage settings by default is using /data dir on local filesystem
# Uncomment storage_service setting If you want to using external storage
# storage_service:
# # ca_bundle is the path to the custom root ca certificate, which will be injected into the truststore
# # of registry's and chart repository's containers. This is usually needed when the user hosts a internal storage with self signed certificate.
# ca_bundle:
# # storage backend, default is filesystem, options include filesystem, azure, gcs, s3, swift and oss
# # for more info about this configuration please refer https://docs.docker.com/registry/configuration/
# filesystem:
# maxthreads: 100
# # set disable to true when you want to disable registry redirect
# redirect:
# disabled: false
# Clair configuration
clair:
# The interval of clair updaters, the unit is hour, set to 0 to disable the updaters.
updaters_interval: 12
# Config http proxy for Clair, e.g. http://my.proxy.com:3128
# Clair doesn't need to connect to harbor internal components via http proxy.
http_proxy:
https_proxy:
no_proxy: 127.0.0.1,localhost,core,registry
jobservice:
# Maximum number of job workers in job service
max_job_workers: 10
chart:
# Change the value of absolute_url to enabled can enable absolute url in chart
absolute_url: disabled
# Log configurations
log:
# options are debug, info, warning, error, fatal
level: info
# Log files are rotated log_rotate_count times before being removed. If count is 0, old versions are removed rather than rotated.
rotate_count: 50
# Log files are rotated only if they grow bigger than log_rotate_size bytes. If size is followed by k, the size is assumed to be in kilobytes.
# If the M is used, the size is in megabytes, and if G is used, the size is in gigabytes. So size 100, size 100k, size 100M and size 100G
# are all valid.
rotate_size: 200M
# The directory on your host that store log
location: /usr/local/docker/harbor/log/
#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version: 1.8.0
退出保存配置完成
啟動install.sh腳本
./install.sh
查看啟動服務(wù)
docker ps | grep goharbor
驗證啟動成功
訪問ip地址
120.79.10.212
輸入admin/123456
登陸成功