# harbor.v2.1.0.tar.gz vi harbor.yml -----------harbor.yml--------- # 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: harbor.yourset.com # 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: /data/key/harbor.yourset.com.crt private_key: /data/key/harbor.yourset.xyz.key # # Uncomment following will enable tls communication between all harbor components # internal_tls: # # set enabled to true means internal tls is enabled # enabled: true # # put your cert and key files on dir # dir: /etc/harbor/tls/internal # 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: Harborxxx # Harbor DB configuration database: # The password for the root user of Harbor DB. Change this before any production use. password: root123 # The maximum number of connections in the idle connection pool. If it
4 启动,进入安装目录
$ docker-compose down -v
# 修改配置后,需要重新检查运行环境 $ ./prepare
# 启动harbor服务 $ docker-compose up -d
5 测试
5.1 网页测试,如果需要https访问,需要申请证书并配置在CLB及harbor服务器上
配置在harbor.yml的https中:
----------------- https: # https port for harbor, default is 443 port: 443 # The path of cert and key files for nginx certificate: /data/key/harbor.yourset.com.crt private_key: /data/key/harbor.yourset.xyz.key
5.2 本地测试,输入密码
5.3 测试推镜像
注意事项:需要在harbor中先建立项目,否则会推送失败
[root@centos ~/tmp]# docker tag hello-world 127.0.0.1/s3/hello-world:v1.0.0 [root@centos ~/tmp]# docker push 127.0.0.1/s3/hello-world:v1.0.0 The push refers to repository [127.0.0.1/s3/hello-world] f22b99068db9: Preparing unauthorized: project not found, name: s3: project not found, name: s3 [root@centos ~/tmp]# docker push 127.0.0.1/s3/hello-world:v1.0.0 The push refers to repository [127.0.0.1/s3/hello-world] f22b99068db9: Pushed v1.0.0: digest: sha256:1b26826f602946860c279fce65829b57792 size: 525
Aug 3 15:32:31 172.30.0.1 registryctl[28778]: 2021-08-03T07:32:31Z [ERROR] [/registryctl/config/config.go:63]: failed to load storage driver, err:No region parameter provided Aug 3 15:32:31 172.30.0.1 registryctl[28778]: 2021-08-03T07:32:31Z [FATAL] [/registryctl/main.go:78]: Failed to load configurations with error: No region parameter provided