github地址:
python
https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md mysql
硬件要求nginx
軟件要求git
安裝步驟github
一、下載redis
地址:https://github.com/goharbor/harbor/releases sql
我這裏選擇離線下載,安裝包比較大,時間稍微有點長docker
二、加壓縮json
tar zxf harbor-offline-installer-v1.6.1.tgz -C /usr/local/ cd /usr/local/
三、修改配置文件harbor.cfgtomcat
這裏面有有必選項和可選項。
_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 = sample_admin@mydomain.com email_password = abc email_from = admin <sample_admin@mydomain.com> 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。其餘的根據本身的喜愛更改,我都是默認
四、安裝
執行./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 .
出現上面的提示表示安裝完成。
五、訪問 http:.//$hostname
使用默認的帳號密碼登陸 admin/Harbor12345
登陸後能夠建立一個用戶
使用建立的用戶登陸,並建立自定義的項目。
注意這裏項目不是倉庫,這裏的項目能夠建立多個倉庫,如nginx,tomcat,mysql等等,它只是一個命名空間,我這裏以環境建立了三個項目
修改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