快速开始
harbor 是vmware 公司的开源的镜像仓库,依赖docker环境和docker-compose编排工具
# 安装harbor
yum install docker-compose -y
wget https://github.com/goharbor/harbor/releases/download/v2.2.0/harbor-offline-installer-v2.2.0.tgz
tar xf harbor-offline-installer-v2.2.0.tgz -C /opt/
mv /opt/{harbor,harbor-v2.2.0}
ln -sfv /opt/{harbor-v2.2.0,harbor}
cp /opt/harbor/{harbor.yml.tmpl,harbor.yml}
# 修改配置文件
vi /opt/harbor/harbor.yml
hostname: test123.com
port: 80
https:
# https port for harbor, default is 443
port: 443
# The path of cert and key files for nginx
certificate: /opt/harbor/ssl/harbor.crt
private_key: /opt/harbor/ssl/harbor.key
创建证书
mkdir /opt/harbor/ssl/ && cd opt/harbor/ssl/
(umask 077;openssl genrsa -out harbor.key 4096)
openssl req -new -x509 -key harbor.key -out harbor.crt -subj "/CN=test123.com" -days=3650
拉取镜像并生成配置文件
/opt/harbor/install.sh
所有推送或拉取镜像的主机都需要执行如下
mkdir /etc/docker/certs.d/test123.com -p
scp habor主机:/opt/harbor/ssl/harbor.crt /etc/docker/certs.d/test123.com/ca.crt
docker login test123.com