github地址:
硬件要求
软件要求
安装步骤
1、下载
地址:
我这里选择离线下载,安装包比较大,时间稍微有点长
2、加压缩
tar zxf harbor-offline-installer-v1.6.1.tgz -C /usr/local/cd /usr/local/
3、修改配置文件harbor.cfg
这里面有有必选项和可选项。
_version = 1.6.0hostname = 192.168.179.130ui_url_protocol = httpmax_job_workers = 3 customize_crt = onssl_cert = /data/cert/server.crtssl_cert_key = /data/cert/server.keysecretkey_path = /dataadmiral_url = NAlog_rotate_count = 50log_rotate_size = 200Mhttp_proxy =https_proxy =no_proxy = 127.0.0.1,localhost,ui,registryemail_identity = email_server = smtp.mydomain.comemail_server_port = 25email_username = sample_admin@mydomain.comemail_password = abcemail_from = adminemail_ssl = falseemail_insecure = falseharbor_admin_password = Harbor12345auth_mode = db_authldap_url = ldaps://ldap.mydomain.comldap_basedn = ou=people,dc=mydomain,dc=comldap_uid = uid ldap_scope = 2 ldap_timeout = 5ldap_verify_cert = trueldap_group_basedn = ou=group,dc=mydomain,dc=comldap_group_filter = objectclass=groupldap_group_gid = cnldap_group_scope = 2self_registration = ontoken_expiration = 30project_creation_restriction = everyonedb_host = postgresqldb_password = root123db_port = 5432db_user = postgresredis_host = redisredis_port = 6379redis_password = redis_db_index = 1,2,3clair_db_host = postgresqlclair_db_password = root123clair_db_port = 5432clair_db_username = postgresclair_db = postgresclair_updaters_interval = 12uaa_endpoint = uaa.mydomain.orguaa_clientid = iduaa_clientsecret = secretuaa_verify_cert = trueuaa_ca_cert = /path/to/ca.pemregistry_storage_provider_name = filesystemregistry_storage_provider_config =registry_custom_ca_bundle =
hostname改成生产环境域名或者IP。其他的根据自己的喜好更改,我都是默认
4、安装
执行./install.sh脚本即可。
Creating network "harbor_harbor" with the default driverCreating harbor-log ... doneCreating registry ... doneCreating harbor-adminserver ... doneCreating redis ... doneCreating harbor-db ... doneCreating harbor-ui ... doneCreating harbor-jobservice ... doneCreating 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
登录后可以创建一个用户
使用创建的用户登录,并创建自定义的项目。
注意这里项目不是仓库,这里的项目可以创建多个仓库,如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: colbyPassword: WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
推送镜像
# docker push 192.168.179.130/prod/colby_httpd:v1.0The push refers to repository [192.168.179.130/prod/colby_httpd]72ffebddfa9f: Pushed 8a788232037e: Pushed v1.0: digest: sha256:7d5610b23bc5575a3a46a7ddaa91ba6173dea4c775b613a010ea83c9b3dd7a7d size: 734