\u7ec4\u4ef6\u8bf4\u660e<\/strong><\/span><\/div>\n\u9700\u8981\u8bf4\u660e\u7684\u662f\uff0charbor\u7684\u6bcf\u4e2a\u7ec4\u4ef6\u90fd\u662f\u4ee5Docker\u5bb9\u5668\u7684\u5f62\u5f0f\u6784\u5efa\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528Docker Compose\u6765\u8fdb\u884c\u90e8\u7f72\uff0c\u5f53\u7136\uff0c\u5982\u679c\u4f60\u7684\u73af\u5883\u4e2d\u4f7f\u7528\u4e86kubernetes\uff0charbor\u4e5f\u63d0\u4f9b\u4e86kubernetes\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n
harbor\u5171\u67098\u4e2a\u5bb9\u5668\u7ec4\u6210\uff1a<\/p>\n
ui\uff1aharbor\u7684\u6838\u5fc3\u670d\u52a1\u3002<\/p>\n
log\uff1a\u8fd0\u884c\u7740rsyslog\u7684\u5bb9\u5668\uff0c\u8fdb\u884c\u65e5\u5fd7\u6536\u96c6\u3002<\/p>\n
mysql\uff1a\u7531\u5b98\u65b9mysql\u955c\u50cf\u6784\u6210\u7684\u6570\u636e\u5e93\u5bb9\u5668<\/p>\n
nginx\uff1a\u4f7f\u7528Nginx\u505a\u53cd\u5411\u4ee3\u7406<\/p>\n
registry\uff1a\u5b98\u65b9\u7684Docker registry<\/p>\n
adminserver\uff1aharbor\u7684\u914d\u7f6e\u6570\u636e\u7ba1\u7406\u5668<\/p>\n
jobservice\uff1aHarbor\u7684\u4efb\u52a1\u7ba1\u7406\u670d\u52a1\u3002<\/p>\n
redis\uff1a\u7528\u4e8e\u5b58\u50a8session<\/p>\n
\u4e0b\u9762\u6211\u4eec\u6240\u6709\u7684\u914d\u7f6e\u90fd\u4ee5harbor 1.5.2\u7248\u672c\u4f5c\u914d\u7f6e\u8bf4\u660e\u3002<\/p>\n
harbor\u53ef\u4ee5\u652f\u6301http\u548chttps\uff0c\u5efa\u8bae\u4f7f\u7528https\uff0chttps\u8bc1\u4e66\u6700\u597d\u662f\u53d7\u4fe1\u4efb\u7684ca\u9881\u53d1\u7684\u8bc1\u4e66\uff0c\u8fd9\u6837\uff0c\u5728\u914d\u7f6edocker\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u9700\u8981\u6dfb\u52a0\"insecure-registries\"\u914d\u7f6e\u9879\u3002\u6211\u4eec\u8fd9\u91cc\u5c31\u76f4\u63a5\u4f7f\u7528\u81ea\u7b7e\u540d\u8bc1\u4e66\u3002<\/p>\n
\u751f\u6210\u8bc1\u4e66\uff1a<\/p>\n
\r\nopenssl genrsa -des3 -out server.key 1024\r\nopenssl rsa -in server.key -out server.key #\u53bb\u9664server.key\u7684\u52a0\u5bc6\u53e3\u4ee4\r\nopenssl req -new -key server.key -out server.csr\r\nopenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt\r\n<\/pre>\n\u5c06\u8bc1\u4e66\u653e\u5165\/data\/certs\/\u76ee\u5f55\u4e0b\uff1a<\/p>\n
\r\ncp server.crt server.key \/data\/certs\r\n<\/pre>\nharbor.cfg\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b<\/strong><\/span><\/div>\nharbor\u7684\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6\u662fharbor.cfg\uff0c\u8def\u5f84\u5728\u6e90\u7801\u76ee\u5f55\u4e0b\u7684make\u76ee\u5f55\u4e0b\uff0c\u793a\u4f8b\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n
\r\n_version = 1.5.0\r\n\r\n# harbor\u7684\u8bbf\u95ee\u5730\u5740\r\nhostname = hub.dz11.com\r\n\r\n# \u4f7f\u7528https\u534f\u8bae\r\nui_url_protocol = https\r\n\r\n# harbor\u7684\u6570\u636e\u5e93\u5bc6\u7801\r\ndb_password = xxxxx\r\n\r\nmax_job_workers = 50\r\ncustomize_crt = on\r\n\r\n# \u8bc1\u4e66\u76f8\u5173\u8def\u5f84\r\nssl_cert = \/data\/certs\/dz11.com.crt\r\nssl_cert_key = \/data\/certs\/dz11.com.key\r\nsecretkey_path = \/data\r\n\r\nadmiral_url = NA\r\n\r\n# \u5b9a\u4e49\u65e5\u5fd7\u6eda\u52a8\r\nlog_rotate_count = 50\r\nlog_rotate_size = 200M\r\n\r\nhttp_proxy =\r\nhttps_proxy =\r\nno_proxy = 127.0.0.1,localhost,ui\r\n\r\n# email\u76f8\u5173\u914d\u7f6e\r\nemail_identity = \r\nemail_server = smtp.163.com\r\nemail_server_port = 25\r\nemail_username = yan_ruo_gu@163.com\r\nemail_password = yan_ruo_gu0711\r\nemail_from = admin \r\nemail_ssl = false\r\n\r\n# \u767b\u5f55harbor\u7684\u7ba1\u7406\u5458\u5bc6\u7801\r\nharbor_admin_password = xxxxxx\r\n\r\n# harbor\u7684\u9a8c\u8bc1\u65b9\u5f0f\uff0c\u652f\u6301db_auth\u548cldap_auth\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684\u662fldap_auth\uff0c\u5982\u679c\u4f7f\u7528db_auth\u7684\u8bdd\uff0c\u76f4\u63a5\u5c06auth_mode\u4fee\u6539\u4e3adb_auth\u5373\u53ef\uff0cldap\u7684\u914d\u7f6e\u4e0d\u518d\u9700\u8981\u3002\r\nauth_mode = ldap_auth\r\nldap_url = ldap:\/\/10.1.1.1:389\r\nldap_searchdn = CN=jenkins,OU=LDAP,OU=Dev-wh.xxx.com,DC=dev-wh,DC=xxx,DC=com\r\nldap_search_pwd = xxxx\r\nldap_basedn = OU=Dev-wh.xxx.com,DC=dev-wh,DC=xxx,DC=com\r\nldap_filter = (objectClass=person)\r\nldap_uid = 0\r\nldap_scope = 2 \r\nldap_timeout = 5\r\n\r\nself_registration = on\r\ntoken_expiration = 30\r\nproject_creation_restriction = everyone\r\nverify_remote_cert = on\r\n\r\n# \u6570\u636e\u5e93\u76f8\u5173\u914d\u7f6e\uff0c\u9ed8\u8ba4\u5982\u679c\u4e0d\u9700\u8981\u4f7f\u7528\u81ea\u5efa\u7684\u6570\u636e\u5e93\uff0c\u8fd9\u4e9b\u914d\u7f6e\u5c31\u90fd\u4e0d\u9700\u8981\r\ndb_host = mysql\r\ndb_password = root123\r\ndb_port = 3306\r\ndb_user = root\r\nredis_url = redis:6379\r\nclair_db_host = postgres\r\nclair_db_password = password\r\nclair_db_port = 5432\r\nclair_db_username = postgres\r\nclair_db = postgres\r\nuaa_endpoint = uaa.mydomain.org\r\nuaa_clientid = id\r\nuaa_clientsecret = secret\r\nuaa_verify_cert = true\r\nuaa_ca_cert = \/path\/to\/ca.pem\r\nregistry_storage_provider_name = filesystem\r\nregistry_storage_provider_config =\r\n<\/pre>\n\u90e8\u7f72harbor<\/strong><\/span><\/div>\nharbor\u652f\u6301docker-compose\u548ckubernetes\u7684\u90e8\u7f72\u65b9\u5f0f\uff0c\u9ed8\u8ba4\u91c7\u7528docker-compose\u4f5c\u5355\u673a\u90e8\u7f72\u3002<\/p>\n
\u5148\u6267\u884c.\/prepare\uff0c\u7136\u540e\u6267\u884c.\/install.sh\u8fdb\u884c\u542f\u52a8\u3002\u6267\u884c.\/install.sh\u7684\u65f6\u5019\uff0c\u5373\u8c03\u7528\u4e86docker-compose\u8fd0\u884c\u4e86\u5f53\u524d\u76ee\u5f55\u4e0b\u7684docker-compose.yml\u6587\u4ef6\u3002<\/p>\n
\u5728\u6267\u884c.prepare\u7684\u65f6\u5019\u629b\u51fa\u5982\u4e0b\u5f02\u5e38\uff1a<\/p>\n
\r\nroot@ubuntu:~\/harbor# .\/prepare \r\nGenerated and saved secret to file: \/data\/secretkey\r\nGenerated configuration file: .\/common\/config\/nginx\/nginx.conf\r\nGenerated configuration file: .\/common\/config\/adminserver\/env\r\nGenerated configuration file: .\/common\/config\/ui\/env\r\nGenerated configuration file: .\/common\/config\/registry\/config.yml\r\nGenerated configuration file: .\/common\/config\/db\/env\r\nGenerated configuration file: .\/common\/config\/jobservice\/env\r\nGenerated configuration file: .\/common\/config\/jobservice\/config.yml\r\nGenerated configuration file: .\/common\/config\/log\/logrotate.conf\r\nGenerated configuration file: .\/common\/config\/jobservice\/config.yml\r\nGenerated configuration file: .\/common\/config\/ui\/app.conf\r\nFail to generate key file: .\/common\/config\/ui\/private_key.pem, cert file: .\/common\/config\/registry\/root.crt\r\n<\/pre>\n\u9700\u8981\u4fee\u6539prepare\u6587\u4ef6\uff0c\u5c06\u7b2c498\u884c\uff1a<\/p>\n
\r\nempty_subj = \"\/C=\/ST=\/L=\/O=\/CN=\/\"\r\n\u4fee\u6539\u5982\u4e0b\uff1a\r\nempty_subj = \"\/C=US\/ST=California\/L=Palo Alto\/O=VMware, Inc.\/OU=Harbor\/CN=notarysigner\"\r\n<\/pre>\n\u5728\u5b9e\u9645\u542f\u52a8\u8fc7\u7a0b\u4e2d\uff0c\u51fa\u73b0\u8fc7registry\u542f\u52a8\u5931\u8d25\u7684\u60c5\u51b5\uff0c\/var\/log\/harbor\/registry.log\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n
\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: panic: unable to configure authorization (token): unable to open token auth root certificate bundle file \"\/etc\/registry\/root.crt\": open \/etc\/registry\/root.crt: permission denied\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: \r\nMay 30 21:06:00 172.18.0.1 registry[3218]: goroutine 1 [running]:\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: panic(0xb4cd40, 0xc4203ae160)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/usr\/local\/go\/src\/runtime\/panic.go:500 +0x1a1\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: github.com\/docker\/distribution\/registry\/handlers.NewApp(0x1067820, 0xc4203a8630, 0xc4202df180, 0x1067820)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/registry\/handlers\/app.go:302 +0x1b6a\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: github.com\/docker\/distribution\/registry.NewRegistry(0x7fcfa30dd198, 0xc4203a8630, 0xc4202df180, 0xe, 0x0, 0x0)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/registry\/registry.go:86 +0x213\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: github.com\/docker\/distribution\/registry.glob..func1(0x108f1a0, 0xc42036d240, 0x1, 0x1)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/registry\/registry.go:55 +0x106\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: github.com\/docker\/distribution\/vendor\/github.com\/spf13\/cobra.(*Command).execute(0x108f1a0, 0xc42036d1f0, 0x1, 0x1, 0x108f1a0, 0xc42036d1f0)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/vendor\/github.com\/spf13\/cobra\/command.go:495 +0x190\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: github.com\/docker\/distribution\/vendor\/github.com\/spf13\/cobra.(*Command).Execute(0x108f340, 0xc4201d7f40, 0xc4200001a0)\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/vendor\/github.com\/spf13\/cobra\/command.go:560 +0x3c3\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: main.main()\r\nMay 30 21:06:00 172.18.0.1 registry[3218]: #011\/go\/src\/github.com\/docker\/distribution\/cmd\/registry\/main.go:24 +0x2d\r\n<\/pre>\n\u8fd9\u662f\u56e0\u4e3aregistry\u5bb9\u5668\u6ca1\u6709\/etc\/registry\/root.crt\u7684\u8bbf\u95ee\u6743\u9650\u5bfc\u81f4\u3002\u8fd9\u4e2a\u6587\u4ef6\u9ed8\u8ba4\u662f\u6302\u8f7d\u7684.\/common\/config\/registry\/root.crt\u8fd9\u4e2a\u6587\u4ef6\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u4f5c\u6388\u6743\u3002<\/p>\n
\u901a\u8fc7\u89c2\u5bdf\u53ef\u77e5\uff0charbor\u7684\u5bb9\u5668\u542f\u52a8\u7528\u6237\u975eroot\u8eab\u4efd\uff0c\u800c\u662f\u4ee5\u4e00\u4e2auid\u548cgid\u90fd\u4e3a10000\u7684\u7528\u6237\u3002\u6240\u4ee5\u53ea\u9700\u8981\u4e3a\u8be5\u7528\u6237\u6388\u6743\u5373\u53ef\uff1a<\/p>\n
\r\nchown 10000.10000 .\/common\/config\/registry\/root.crt\r\n<\/pre>\n\u6b63\u5e38\u542f\u52a8\u4e4b\u540e\uff0c\u914d\u7f6e\u5b8c\u6210\u3002<\/p>\n
\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\u8bbf\u95ee\uff1a https:\/\/hub.dz11.com<\/p>\n
\u6ce8\u610f\u4e8b\u9879<\/strong><\/span><\/div>\n\u9700\u8981\u8bf4\u660e\u7684\u662f\uff0charbor\u652f\u6301http\u548chttps\uff0c\u4f46\u5982\u679c\u4f7f\u7528http\u7684\u8bdd\uff0c\u5728\u62c9\u53d6\u955c\u50cf\u7684\u65f6\u5019\uff0c\u4f1a\u629b\u51fa\u4ed3\u5e93\u4e0d\u53d7\u4fe1\u4efb\u7684\u5f02\u5e38\u3002\u9700\u8981\u5728\u6240\u6709\u7684docker\u5ba2\u6237\u7aef\u7684docker\u914d\u7f6e\u6587\u4ef6\/etc\/docker\/daemon.json\u4e2d\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n
\r\n{\r\n \"insecure-registries\": [\"https:\/\/hub.dz11.com\"],\r\n}\r\n<\/pre>\n\u5982\u679c\u4f7f\u7528\u81ea\u7b7e\u540d\u7684https\u8bc1\u4e66\uff0c\u4ecd\u7136\u4f1a\u63d0\u793a\u8bc1\u4e66\u4e0d\u53d7\u4fe1\u4efb\u7684\u95ee\u9898\u3002\u9700\u8981\u5c06\u81ea\u7b7e\u540d\u7684ca\u8bc1\u4e66\u53d1\u9001\u5230\u6240\u6709\u7684docker\u5ba2\u6237\u7aef\u7684\u6307\u5b9a\u76ee\u5f55\u3002<\/p>\n
\u5173\u4e8e\u4f7f\u7528\u81ea\u7b7e\u540d\u8bc1\u4e66\u914d\u7f6eharbor\u7684\u5177\u4f53\u8fc7\u7a0b\u53ef\u4ee5\u53c2\u8003\uff1ahttps:\/\/github.com\/WingkaiHo\/docker-calico\/blob\/master\/harbor\/README.md<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u8bf4harbor\u4e4b\u524d\uff0c\u6211\u4eec\u9996\u5148\u8bf4\u4e00\u8bf4\u76f4\u63a5\u4f7f\u7528docker registry\u7684\u4e00\u4e9b\u7f3a\u9677\uff1a \u7f3a\u5c11\u8ba4\u8bc1\u673a\u5236\uff0c\u4efb\u4f55\u4eba\u90fd […]<\/p>\n","protected":false},"author":668,"featured_media":142060,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-193753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/193753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=193753"}],"version-history":[{"count":4,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/193753\/revisions"}],"predecessor-version":[{"id":193758,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/193753\/revisions\/193758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/142060"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=193753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=193753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=193753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}