CentOS7搭建Harbor镜像仓库及https处理

前言

笔者在规划服务容器化的过程中,对镜像管理有一些思考,最终决定使用Harbor管理镜像;

在局域网搭建Harbor私有仓库,在构建镜像的服务器中构建好服务镜像,并且将镜像传上harbor中,那么测试及开发环境只需要拉取镜像运行,即完成服务的更新:

部署过程

修改hosts文件

笔者以下使用的域名hub.domain.com,并不是实际注册的域名,而是通过修改Hosts文件指向了这个Harbor服务器的地址,你可以修改为自己需要的域名。

[root@harbor ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.43 hub.domain.com

创建为Harbor使用Https的CA证书

  1. 创建证书存放目录

    [root@harbor ~]# mkdir -p /data/cert
    [root@harbor ~]# cd /data/cert/
    
  2. 获得证书授权

    [root@harbor cert]# openssl genrsa -out ca.key 4096
    [root@harbor cert]# openssl req -x509 -new -nodes -sha512 -days 3650 \
        -subj "/C=CN/ST=Guangzhou/L=Guangzhou/O=example/CN=hub.domain.com" \
        -key ca.key \
        -out ca.crt
    
  3. 获得证书服务器

    # 创建私钥
    [root@harbor cert]# openssl genrsa -out hub.domain.com.key 4096
    # 生成证书签名
    [root@harbor cert]# openssl req -sha512 -new \
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值