您的位置:首页 > 运维架构 > Docker

企业级Docker私有仓库Harbor管理平台构建示例

2016-12-13 14:51 711 查看

Harbor:

著名虚拟化厂商VMware开源的docker仓库平台解决方案!

- 项目下载地址

- 安装Docker 以及 docker-compose [参考官网]

由于所需要的镜像较多,在下载镜像之前建议大家配置加速器,推荐大家使用Daocloud提供的加速器

其实通过github 大家都已经可以查看到有非常详细的配置使用介绍但是笔者在之前的配置中还是踩了好多坑,参考官方给的示例
配置证书
无法使用…… 被坑的我体无完肤….无语死了. 所以下面给出了配置步骤,其实很简单……….

[root@harbor ]# ls
common  docker-compose.yml
harbor.cfg
install.sh
LICENSE
NOTICE
prepare     // 初始化配置脚本
[root@harbor ]# vim harbor.cfg
#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 = hub.test.com

#The protocol for accessing the UI and token/notification service, by default it is http.
#It can be set to https if ssl is enabled on nginx.
ui_url_protocol = https    //   基于TLS认证连接

#Email server uses the given username and password to authenticate on TLS connections to host and act as identity.
#Identity left blank to act as username.
email_identity =

email_server = mail.test.com
email_server_port = 25
email_username = test@test.com
email_password = password
email_from = admin <admin@test.com>
email_ssl = false

##The initial password of Harbor admin, only works for the first time when Harbor starts.
#It has no effect after the first launch of Harbor.
#Change the admin password from UI after launching Harbor.
harbor_admin_password = password     // 管理员密码

verify_remote_cert = on

#Determine whether or not to generate certificate for the registry's token.
#If the value is on, the prepare script creates new root cert and private key
#for generating token to access the registry. If the value is off, a key/certificate must
#be supplied for token generation.
customize_crt = on
.......
......
.....
#The path of cert and key files for nginx, they are applied only the protocol is set to https
ssl_cert = /root/cert/ca.crt
ssl_cert_key = /root/cert/ca.key

[root@harbor ]# mkdir /root/cert
[root@harbor ]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout /root/cert/ca.key -x509 -days 365 -out /root/cert/ca.crt
省略....
.....
[root@harbor ]# ls /root/cert
ca.crt ca.key
[root@harbor ]# ./prepare
[root@harbor ]# docker-compose up -d

# 在仓库本机以及其他节点配置证书
# mkdir /etc/docker/certs.d/jevic.hub/
# cp /root/cert/ca.key /etc/docker/certs.d/jevic.hub/
# systemctl restart docker


使用域名访问即可!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  docker 私有仓库 harbor