基于 Harbor 搭建 Docker 私有镜像仓库

下载地址https://github.com/vmware/harbor/releases下载最新离线安装包

官方安装配置指南https://github.com/vmware/harbor/blob/master/docs/installation_guide.md

生成证书

#/bin/bash
mkdir /root/cert && cd /root/cert
youdomain=brave.w    #修改域名地址,前提是你能解析
openssl req -nodes -subj "/C=CN/ST=Jiangxi/L=Nanchang/CN=$youdomain" \
   -newkey rsa:4096 -nodes -sha256 -keyout ca.key \
   -x509 -days 365 -out ca.crt
openssl req -nodes -subj "/C=CN/ST=Jiangxi/L=Nanchang/CN=$youdomain" \
   -newkey rsa:4096 -nodes -sha256 -keyout $youdomain.key \
   -out $youdomain.csr
openssl x509 -req -days 365 -in $youdomain.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out $youdomain.crt

mv brave.w.{crt,key} /root/cert

cp brave.w.crt /etc/docker/certs.d/brave.w/ca.crt

vim harbor.cfg

hostname = brave.w
ui_url_protocol = https
ssl_cert = /root/cert/brave.w.crt
ssl_cert_key = /root/cert/brave.w.key
harbor_admin_password =

./prepare为Harbour生成配置文件

./install.sh安装完成后使用浏览器访问https://brave.w/账号:admin 密码:配置文件内 harbor_admin_password = 基于 Harbor 搭建 Docker 私有镜像仓库_harbor

基于 Harbor 搭建 Docker 私有镜像仓库_harbor_02图片内 wang 项目是我新建的至此 harbor就搭建好了。客户端证书存放地址:/etc/docker/certs.d/brave.w/ca.crt