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

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
使用域名访问即可!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值