harbor安裝

github地址:

https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md


硬件要求

image.png


軟件要求



image.png


image.png

安裝步驟

1、下載

地址:https://github.com/goharbor/harbor/releases

image.png

我這裏選擇離線下載,安裝包比較大,時間稍微有點長


2、加壓縮

 tar zxf harbor-offline-installer-v1.6.1.tgz -C /usr/local/
cd /usr/local/


3、修改配置文件harbor.cfg

這裏面有有必選項和可選項。

_version = 1.6.0
hostname = 192.168.179.130
ui_url_protocol = http
max_job_workers = 3 
customize_crt = on
ssl_cert = /data/cert/server.crt
ssl_cert_key = /data/cert/server.key
secretkey_path = /data
admiral_url = NA
log_rotate_count = 50
log_rotate_size = 200M
http_proxy =
https_proxy =
no_proxy = 127.0.0.1,localhost,ui,registry
email_identity = 
email_server = smtp.mydomain.com
email_server_port = 25
email_username = [email protected]
email_password = abc
email_from = admin <[email protected]>
email_ssl = false
email_insecure = false
harbor_admin_password = Harbor12345
auth_mode = db_auth
ldap_url = ldaps://ldap.mydomain.com
ldap_basedn = ou=people,dc=mydomain,dc=com
ldap_uid = uid 
ldap_scope = 2 
ldap_timeout = 5
ldap_verify_cert = true
ldap_group_basedn = ou=group,dc=mydomain,dc=com
ldap_group_filter = objectclass=group
ldap_group_gid = cn
ldap_group_scope = 2
self_registration = on
token_expiration = 30
project_creation_restriction = everyone
db_host = postgresql
db_password = root123
db_port = 5432
db_user = postgres
redis_host = redis
redis_port = 6379
redis_password = 
redis_db_index = 1,2,3
clair_db_host = postgresql
clair_db_password = root123
clair_db_port = 5432
clair_db_username = postgres
clair_db = postgres
clair_updaters_interval = 12
uaa_endpoint = uaa.mydomain.org
uaa_clientid = id
uaa_clientsecret = secret
uaa_verify_cert = true
uaa_ca_cert = /path/to/ca.pem
registry_storage_provider_name = filesystem
registry_storage_provider_config =
registry_custom_ca_bundle =

hostname改成生產環境域名或者IP。其他的根據自己的喜好更改,我都是默認


4、安裝

執行./install.sh腳本即可。

Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registry           ... done
Creating harbor-adminserver ... done
Creating redis              ... done
Creating harbor-db          ... done
Creating harbor-ui          ... done
Creating harbor-jobservice  ... done
Creating nginx              ... done
✔ ----Harbor has been installed and started successfully.----
Now you should be able to visit the admin portal at http://192.168.179.130. 
For more details, please visit https://github.com/goharbor/harbor .

出現上面的提示表示安裝完成。


5、訪問 http:.//$hostname

使用默認的賬號密碼登錄  admin/Harbor12345

image.png



登錄後可以創建一個用戶

image.png


使用創建的用戶登錄,並創建自定義的項目。

注意這裏項目不是倉庫,這裏的項目可以創建多個倉庫,如nginx,tomcat,mysql等等,它只是一個命名空間,我這裏以環境創建了三個項目

image.png


修改docker客戶端daemon.json配置文件,使docker客戶端信任我們的harbor registry

{
    "insecure-registries": ["192.168.179.130"]
}


本地鏡像打tag

docker tag 192.168.179.130/colby_httpd:v2.0-4 192.168.179.130/prod/colby_httpd:v1.0



使用創建的用戶名登錄docker harbor

[root@localhost harbor]# docker login 192.168.179.130        
Username: colby
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded


推送鏡像

# docker push 192.168.179.130/prod/colby_httpd:v1.0
The push refers to repository [192.168.179.130/prod/colby_httpd]
72ffebddfa9f: Pushed 
8a788232037e: Pushed 
v1.0: digest: sha256:7d5610b23bc5575a3a46a7ddaa91ba6173dea4c775b613a010ea83c9b3dd7a7d size: 734


image.png





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章